<!DOCTYPE html>
<!-- saved from url=(0046)https://www.zybuluo.com/hanbingtao/note/448086 -->
<html class="theme theme-white"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    
    <meta name="description" content="Cmd Markdown 编辑阅读器，支持实时同步预览，区分写作和阅读模式，支持在线存储，分享文稿网址。">
    <meta name="author" content="Jiawei Zhang">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    
    <title>零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器</title>


    <link href="https://www.zybuluo.com/static/img/favicon.png" type="image/x-icon" rel="icon">

    <link href="./零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器_files/1bc053c8.base.lib.min.css" rel="stylesheet" media="screen">


    
    <!-- id="prettify-style" will be used to get the link element below and change href to change prettify code, so it can't be in beginmin/endmin block. -->
    <link id="prettify-style" href="./零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器_files/prettify-cmd.css" type="text/css" rel="stylesheet">
    <!--
    <link id="mermaid-style" href="https://www.zybuluo.com/static/editor/libs/mermaid/mermaid.forest.css" type="text/css" rel="stylesheet">
    -->
    <link href="./零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器_files/45c7d56d.layout.min.css" rel="stylesheet" media="screen">


    

    <script async="" src="./零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器_files/analytics.js"></script><script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

      ga('create', 'UA-44461741-1', 'zybuluo.com');
      ga('send', 'pageview');
    </script>
<style type="text/css">.MathJax_Hover_Frame {border-radius: .25em; -webkit-border-radius: .25em; -moz-border-radius: .25em; -khtml-border-radius: .25em; box-shadow: 0px 0px 15px #83A; -webkit-box-shadow: 0px 0px 15px #83A; -moz-box-shadow: 0px 0px 15px #83A; -khtml-box-shadow: 0px 0px 15px #83A; border: 1px solid #A6D ! important; display: inline-block; position: absolute}
.MathJax_Hover_Arrow {position: absolute; width: 15px; height: 11px; cursor: pointer}
</style><style type="text/css">#MathJax_About {position: fixed; left: 50%; width: auto; text-align: center; border: 3px outset; padding: 1em 2em; background-color: #DDDDDD; color: black; cursor: default; font-family: message-box; font-size: 120%; font-style: normal; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; z-index: 201; border-radius: 15px; -webkit-border-radius: 15px; -moz-border-radius: 15px; -khtml-border-radius: 15px; box-shadow: 0px 10px 20px #808080; -webkit-box-shadow: 0px 10px 20px #808080; -moz-box-shadow: 0px 10px 20px #808080; -khtml-box-shadow: 0px 10px 20px #808080; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
.MathJax_Menu {position: absolute; background-color: white; color: black; width: auto; padding: 5px 0px; border: 1px solid #CCCCCC; margin: 0; cursor: default; font: menu; text-align: left; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; z-index: 201; border-radius: 5px; -webkit-border-radius: 5px; -moz-border-radius: 5px; -khtml-border-radius: 5px; box-shadow: 0px 10px 20px #808080; -webkit-box-shadow: 0px 10px 20px #808080; -moz-box-shadow: 0px 10px 20px #808080; -khtml-box-shadow: 0px 10px 20px #808080; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
.MathJax_MenuItem {padding: 1px 2em; background: transparent}
.MathJax_MenuArrow {position: absolute; right: .5em; color: #666666}
.MathJax_MenuActive .MathJax_MenuArrow {color: white}
.MathJax_MenuCheck {position: absolute; left: .7em}
.MathJax_MenuRadioCheck {position: absolute; left: .7em}
.MathJax_MenuLabel {padding: 1px 2em 3px 1.33em; font-style: italic}
.MathJax_MenuRule {border-top: 1px solid #DDDDDD; margin: 4px 3px}
.MathJax_MenuDisabled {color: GrayText}
.MathJax_MenuActive {background-color: #606872; color: white}
.MathJax_Menu_Close {position: absolute; width: 31px; height: 31px; top: -15px; left: -15px}
</style><style type="text/css">#MathJax_Zoom {position: absolute; background-color: #F0F0F0; overflow: auto; display: block; z-index: 301; padding: .5em; border: 1px solid black; margin: 0; font-weight: normal; font-style: normal; text-align: left; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; box-shadow: 5px 5px 15px #AAAAAA; -webkit-box-shadow: 5px 5px 15px #AAAAAA; -moz-box-shadow: 5px 5px 15px #AAAAAA; -khtml-box-shadow: 5px 5px 15px #AAAAAA; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
#MathJax_ZoomOverlay {position: absolute; left: 0; top: 0; z-index: 300; display: inline-block; width: 100%; height: 100%; border: 0; padding: 0; margin: 0; background-color: white; opacity: 0; filter: alpha(opacity=0)}
#MathJax_ZoomFrame {position: relative; display: inline-block; height: 0; width: 0}
#MathJax_ZoomEventTrap {position: absolute; left: 0; top: 0; z-index: 302; display: inline-block; border: 0; padding: 0; margin: 0; background-color: white; opacity: 0; filter: alpha(opacity=0)}
</style><style type="text/css">.MathJax_Preview {color: #888}
#MathJax_Message {position: fixed; left: 1em; bottom: 1.5em; background-color: #E6E6E6; border: 1px solid #959595; margin: 0px; padding: 2px 8px; z-index: 102; color: black; font-size: 80%; width: auto; white-space: nowrap}
#MathJax_MSIE_Frame {position: absolute; top: 0; left: 0; width: 0px; z-index: 101; border: 0px; margin: 0px; padding: 0px}
.MathJax_Error {color: #CC0000; font-style: italic}
</style><style type="text/css">.MathJax_SVG_Display {text-align: center; margin: 1em 0em; position: relative; display: block; width: 100%}
#MathJax_SVG_Tooltip {background-color: InfoBackground; color: InfoText; border: 1px solid black; box-shadow: 2px 2px 5px #AAAAAA; -webkit-box-shadow: 2px 2px 5px #AAAAAA; -moz-box-shadow: 2px 2px 5px #AAAAAA; -khtml-box-shadow: 2px 2px 5px #AAAAAA; padding: 3px 4px; z-index: 401; position: absolute; left: 0; top: 0; width: auto; height: auto; display: none}
.MathJax_SVG {display: inline; font-style: normal; font-weight: normal; line-height: normal; font-size: 100%; font-size-adjust: none; text-indent: 0; text-align: left; text-transform: none; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; border: 0; padding: 0; margin: 0}
.MathJax_SVG * {transition: none; -webkit-transition: none; -moz-transition: none; -ms-transition: none; -o-transition: none}
.mjx-svg-href {fill: blue; stroke: blue}
.MathJax_SVG_Processing {visibility: hidden; position: absolute; top: 0; left: 0; width: 0; height: 0; overflow: hidden; display: block}
.MathJax_SVG_Processed {display: none!important}
.MathJax_SVG_ExBox {display: block; overflow: hidden; width: 1px; height: 60ex}
.MathJax_SVG .noError {vertical-align: ; font-size: 90%; text-align: left; color: black; padding: 1px 3px; border: 1px solid}
</style></head>

<body class="theme  theme-white pace-done"><div style="visibility: hidden; overflow: hidden; position: absolute; top: 0px; height: 1px; width: auto; padding: 0px; border: 0px; margin: 0px; text-align: left; text-indent: 0px; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal;"><div id="MathJax_SVG_Hidden"></div><svg><defs id="MathJax_SVG_glyphs"><path id="MJMATHI-66" stroke-width="1" d="M118 -162Q120 -162 124 -164T135 -167T147 -168Q160 -168 171 -155T187 -126Q197 -99 221 27T267 267T289 382V385H242Q195 385 192 387Q188 390 188 397L195 425Q197 430 203 430T250 431Q298 431 298 432Q298 434 307 482T319 540Q356 705 465 705Q502 703 526 683T550 630Q550 594 529 578T487 561Q443 561 443 603Q443 622 454 636T478 657L487 662Q471 668 457 668Q445 668 434 658T419 630Q412 601 403 552T387 469T380 433Q380 431 435 431Q480 431 487 430T498 424Q499 420 496 407T491 391Q489 386 482 386T428 385H372L349 263Q301 15 282 -47Q255 -132 212 -173Q175 -205 139 -205Q107 -205 81 -186T55 -132Q55 -95 76 -78T118 -61Q162 -61 162 -103Q162 -122 151 -136T127 -157L118 -162Z"></path><path id="MJMAIN-28" stroke-width="1" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path><path id="MJMATHI-78" stroke-width="1" d="M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"></path><path id="MJMAIN-29" stroke-width="1" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path><path id="MJMAIN-3D" stroke-width="1" d="M56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153Z"></path><path id="MJMATHI-79" stroke-width="1" d="M21 287Q21 301 36 335T84 406T158 442Q199 442 224 419T250 355Q248 336 247 334Q247 331 231 288T198 191T182 105Q182 62 196 45T238 27Q261 27 281 38T312 61T339 94Q339 95 344 114T358 173T377 247Q415 397 419 404Q432 431 462 431Q475 431 483 424T494 412T496 403Q496 390 447 193T391 -23Q363 -106 294 -155T156 -205Q111 -205 77 -183T43 -117Q43 -95 50 -80T69 -58T89 -48T106 -45Q150 -45 150 -87Q150 -107 138 -122T115 -142T102 -147L99 -148Q101 -153 118 -160T152 -167H160Q177 -167 186 -165Q219 -156 247 -127T290 -65T313 -9T321 21L315 17Q309 13 296 6T270 -6Q250 -11 231 -11Q185 -11 150 11T104 82Q103 89 103 113Q103 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Z"></path><path id="MJMATHI-68" stroke-width="1" d="M137 683Q138 683 209 688T282 694Q294 694 294 685Q294 674 258 534Q220 386 220 383Q220 381 227 388Q288 442 357 442Q411 442 444 415T478 336Q478 285 440 178T402 50Q403 36 407 31T422 26Q450 26 474 56T513 138Q516 149 519 151T535 153Q555 153 555 145Q555 144 551 130Q535 71 500 33Q466 -10 419 -10H414Q367 -10 346 17T325 74Q325 90 361 192T398 345Q398 404 354 404H349Q266 404 205 306L198 293L164 158Q132 28 127 16Q114 -11 83 -11Q69 -11 59 -2T48 16Q48 30 121 320L195 616Q195 629 188 632T149 637H128Q122 643 122 645T124 664Q129 683 137 683Z"></path><path id="MJMATHI-77" stroke-width="1" d="M580 385Q580 406 599 424T641 443Q659 443 674 425T690 368Q690 339 671 253Q656 197 644 161T609 80T554 12T482 -11Q438 -11 404 5T355 48Q354 47 352 44Q311 -11 252 -11Q226 -11 202 -5T155 14T118 53T104 116Q104 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Q21 293 29 315T52 366T96 418T161 441Q204 441 227 416T250 358Q250 340 217 250T184 111Q184 65 205 46T258 26Q301 26 334 87L339 96V119Q339 122 339 128T340 136T341 143T342 152T345 165T348 182T354 206T362 238T373 281Q402 395 406 404Q419 431 449 431Q468 431 475 421T483 402Q483 389 454 274T422 142Q420 131 420 107V100Q420 85 423 71T442 42T487 26Q558 26 600 148Q609 171 620 213T632 273Q632 306 619 325T593 357T580 385Z"></path><path id="MJMAIN-2217" stroke-width="1" d="M229 286Q216 420 216 436Q216 454 240 464Q241 464 245 464T251 465Q263 464 273 456T283 436Q283 419 277 356T270 286L328 328Q384 369 389 372T399 375Q412 375 423 365T435 338Q435 325 425 315Q420 312 357 282T289 250L355 219L425 184Q434 175 434 161Q434 146 425 136T401 125Q393 125 383 131T328 171L270 213Q283 79 283 63Q283 53 276 44T250 35Q231 35 224 44T216 63Q216 80 222 143T229 213L171 171Q115 130 110 127Q106 124 100 124Q87 124 76 134T64 161Q64 166 64 169T67 175T72 181T81 188T94 195T113 204T138 215T170 230T210 250L74 315Q65 324 65 338Q65 353 74 363T98 374Q106 374 116 368T171 328L229 286Z"></path><path id="MJMAIN-2B" stroke-width="1" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path><path id="MJMATHI-62" stroke-width="1" d="M73 647Q73 657 77 670T89 683Q90 683 161 688T234 694Q246 694 246 685T212 542Q204 508 195 472T180 418L176 399Q176 396 182 402Q231 442 283 442Q345 442 383 396T422 280Q422 169 343 79T173 -11Q123 -11 82 27T40 150V159Q40 180 48 217T97 414Q147 611 147 623T109 637Q104 637 101 637H96Q86 637 83 637T76 640T73 647ZM336 325V331Q336 405 275 405Q258 405 240 397T207 376T181 352T163 330L157 322L136 236Q114 150 114 114Q114 66 138 42Q154 26 178 26Q211 26 245 58Q270 81 285 114T318 219Q336 291 336 325Z"></path><path id="MJMAIN-31" stroke-width="1" d="M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z"></path><path id="MJMAIN-30" stroke-width="1" d="M96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597Z"></path><path id="MJMAIN-35" stroke-width="1" d="M164 157Q164 133 148 117T109 101H102Q148 22 224 22Q294 22 326 82Q345 115 345 210Q345 313 318 349Q292 382 260 382H254Q176 382 136 314Q132 307 129 306T114 304Q97 304 95 310Q93 314 93 485V614Q93 664 98 664Q100 666 102 666Q103 666 123 658T178 642T253 634Q324 634 389 662Q397 666 402 666Q410 666 410 648V635Q328 538 205 538Q174 538 149 544L139 546V374Q158 388 169 396T205 412T256 420Q337 420 393 355T449 201Q449 109 385 44T229 -22Q148 -22 99 32T50 154Q50 178 61 192T84 210T107 214Q132 214 148 197T164 157Z"></path><path id="MJMAIN-78" stroke-width="1" d="M201 0Q189 3 102 3Q26 3 17 0H11V46H25Q48 47 67 52T96 61T121 78T139 96T160 122T180 150L226 210L168 288Q159 301 149 315T133 336T122 351T113 363T107 370T100 376T94 379T88 381T80 383Q74 383 44 385H16V431H23Q59 429 126 429Q219 429 229 431H237V385Q201 381 201 369Q201 367 211 353T239 315T268 274L272 270L297 304Q329 345 329 358Q329 364 327 369T322 376T317 380T310 384L307 385H302V431H309Q324 428 408 428Q487 428 493 431H499V385H492Q443 385 411 368Q394 360 377 341T312 257L296 236L358 151Q424 61 429 57T446 50Q464 46 499 46H516V0H510H502Q494 1 482 1T457 2T432 2T414 3Q403 3 377 3T327 1L304 0H295V46H298Q309 46 320 51T331 63Q331 65 291 120L250 175Q249 174 219 133T185 88Q181 83 181 74Q181 63 188 55T206 46Q208 46 208 23V0H201Z"></path><path id="MJMAIN-2C" stroke-width="1" d="M78 35T78 60T94 103T137 121Q165 121 187 96T210 8Q210 -27 201 -60T180 -117T154 -158T130 -185T117 -194Q113 -194 104 -185T95 -172Q95 -168 106 -156T131 -126T157 -76T173 -3V9L172 8Q170 7 167 6T161 3T152 1T140 0Q113 0 96 17Z"></path><path id="MJMAIN-32" stroke-width="1" d="M109 429Q82 429 66 447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429 383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99 409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86 81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305 340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154 602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154 447T109 429Z"></path><path id="MJMAIN-33" stroke-width="1" d="M127 463Q100 463 85 480T69 524Q69 579 117 622T233 665Q268 665 277 664Q351 652 390 611T430 522Q430 470 396 421T302 350L299 348Q299 347 308 345T337 336T375 315Q457 262 457 175Q457 96 395 37T238 -22Q158 -22 100 21T42 130Q42 158 60 175T105 193Q133 193 151 175T169 130Q169 119 166 110T159 94T148 82T136 74T126 70T118 67L114 66Q165 21 238 21Q293 21 321 74Q338 107 338 175V195Q338 290 274 322Q259 328 213 329L171 330L168 332Q166 335 166 348Q166 366 174 366Q202 366 232 371Q266 376 294 413T322 525V533Q322 590 287 612Q265 626 240 626Q208 626 181 615T143 592T132 580H135Q138 579 143 578T153 573T165 566T175 555T183 540T186 520Q186 498 172 481T127 463Z"></path><path id="MJMAIN-34" stroke-width="1" d="M462 0Q444 3 333 3Q217 3 199 0H190V46H221Q241 46 248 46T265 48T279 53T286 61Q287 63 287 115V165H28V211L179 442Q332 674 334 675Q336 677 355 677H373L379 671V211H471V165H379V114Q379 73 379 66T385 54Q393 47 442 46H471V0H462ZM293 211V545L74 212L183 211H293Z"></path><path id="MJMAIN-77" stroke-width="1" d="M90 368Q84 378 76 380T40 385H18V431H24L43 430Q62 430 84 429T116 428Q206 428 221 431H229V385H215Q177 383 177 368Q177 367 221 239L265 113L339 328L333 345Q323 374 316 379Q308 384 278 385H258V431H264Q270 428 348 428Q439 428 454 431H461V385H452Q404 385 404 369Q404 366 418 324T449 234T481 143L496 100L537 219Q579 341 579 347Q579 363 564 373T530 385H522V431H529Q541 428 624 428Q692 428 698 431H703V385H697Q696 385 691 385T682 384Q635 377 619 334L559 161Q546 124 528 71Q508 12 503 1T487 -11H479Q460 -11 456 -4Q455 -3 407 133L361 267Q359 263 266 -4Q261 -11 243 -11H238Q225 -11 220 -3L90 368Z"></path><path id="MJMATHI-54" stroke-width="1" d="M40 437Q21 437 21 445Q21 450 37 501T71 602L88 651Q93 669 101 677H569H659Q691 677 697 676T704 667Q704 661 687 553T668 444Q668 437 649 437Q640 437 637 437T631 442L629 445Q629 451 635 490T641 551Q641 586 628 604T573 629Q568 630 515 631Q469 631 457 630T439 622Q438 621 368 343T298 60Q298 48 386 46Q418 46 427 45T436 36Q436 31 433 22Q429 4 424 1L422 0Q419 0 415 0Q410 0 363 1T228 2Q99 2 64 0H49Q43 6 43 9T45 27Q49 40 55 46H83H94Q174 46 189 55Q190 56 191 56Q196 59 201 76T241 233Q258 301 269 344Q339 619 339 625Q339 630 310 630H279Q212 630 191 624Q146 614 121 583T67 467Q60 445 57 441T43 437H40Z"></path><path id="MJMAIN-2E" stroke-width="1" d="M78 60Q78 84 95 102T138 120Q162 120 180 104T199 61Q199 36 182 18T139 0T96 17T78 60Z"></path><path id="MJMAIN-AF" stroke-width="1" d="M69 544V590H430V544H69Z"></path><path id="MJMATHI-65" stroke-width="1" d="M39 168Q39 225 58 272T107 350T174 402T244 433T307 442H310Q355 442 388 420T421 355Q421 265 310 237Q261 224 176 223Q139 223 138 221Q138 219 132 186T125 128Q125 81 146 54T209 26T302 45T394 111Q403 121 406 121Q410 121 419 112T429 98T420 82T390 55T344 24T281 -1T205 -11Q126 -11 83 42T39 168ZM373 353Q367 405 305 405Q272 405 244 391T199 357T170 316T154 280T149 261Q149 260 169 260Q282 260 327 284T373 353Z"></path><path id="MJMAIN-2212" stroke-width="1" d="M84 237T84 250T98 270H679Q694 262 694 250T679 230H98Q84 237 84 250Z"></path><path id="MJMATHI-4E" stroke-width="1" d="M234 637Q231 637 226 637Q201 637 196 638T191 649Q191 676 202 682Q204 683 299 683Q376 683 387 683T401 677Q612 181 616 168L670 381Q723 592 723 606Q723 633 659 637Q635 637 635 648Q635 650 637 660Q641 676 643 679T653 683Q656 683 684 682T767 680Q817 680 843 681T873 682Q888 682 888 672Q888 650 880 642Q878 637 858 637Q787 633 769 597L620 7Q618 0 599 0Q585 0 582 2Q579 5 453 305L326 604L261 344Q196 88 196 79Q201 46 268 46H278Q284 41 284 38T282 19Q278 6 272 0H259Q228 2 151 2Q123 2 100 2T63 2T46 1Q31 1 31 10Q31 14 34 26T39 40Q41 46 62 46Q130 49 150 85Q154 91 221 362L289 634Q287 635 234 637Z"></path><path id="MJMATHI-45" stroke-width="1" d="M492 213Q472 213 472 226Q472 230 477 250T482 285Q482 316 461 323T364 330H312Q311 328 277 192T243 52Q243 48 254 48T334 46Q428 46 458 48T518 61Q567 77 599 117T670 248Q680 270 683 272Q690 274 698 274Q718 274 718 261Q613 7 608 2Q605 0 322 0H133Q31 0 31 11Q31 13 34 25Q38 41 42 43T65 46Q92 46 125 49Q139 52 144 61Q146 66 215 342T285 622Q285 629 281 629Q273 632 228 634H197Q191 640 191 642T193 659Q197 676 203 680H757Q764 676 764 669Q764 664 751 557T737 447Q735 440 717 440H705Q698 445 698 453L701 476Q704 500 704 528Q704 558 697 578T678 609T643 625T596 632T532 634H485Q397 633 392 631Q388 629 386 622Q385 619 355 499T324 377Q347 376 372 376H398Q464 376 489 391T534 472Q538 488 540 490T557 493Q562 493 565 493T570 492T572 491T574 487T577 483L544 351Q511 218 508 216Q505 213 492 213Z"></path><path id="MJMATHI-6E" stroke-width="1" d="M21 287Q22 293 24 303T36 341T56 388T89 425T135 442Q171 442 195 424T225 390T231 369Q231 367 232 367L243 378Q304 442 382 442Q436 442 469 415T503 336T465 179T427 52Q427 26 444 26Q450 26 453 27Q482 32 505 65T540 145Q542 153 560 153Q580 153 580 145Q580 144 576 130Q568 101 554 73T508 17T439 -10Q392 -10 371 17T350 73Q350 92 386 193T423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 180T152 343Q153 348 153 366Q153 405 129 405Q91 405 66 305Q60 285 60 284Q58 278 41 278H27Q21 284 21 287Z"></path><path id="MJSZ2-2211" stroke-width="1" d="M60 948Q63 950 665 950H1267L1325 815Q1384 677 1388 669H1348L1341 683Q1320 724 1285 761Q1235 809 1174 838T1033 881T882 898T699 902H574H543H251L259 891Q722 258 724 252Q725 250 724 246Q721 243 460 -56L196 -356Q196 -357 407 -357Q459 -357 548 -357T676 -358Q812 -358 896 -353T1063 -332T1204 -283T1307 -196Q1328 -170 1348 -124H1388Q1388 -125 1381 -145T1356 -210T1325 -294L1267 -449L666 -450Q64 -450 61 -448Q55 -446 55 -439Q55 -437 57 -433L590 177Q590 178 557 222T452 366T322 544L56 909L55 924Q55 945 60 948Z"></path><path id="MJMATHI-69" stroke-width="1" d="M184 600Q184 624 203 642T247 661Q265 661 277 649T290 619Q290 596 270 577T226 557Q211 557 198 567T184 600ZM21 287Q21 295 30 318T54 369T98 420T158 442Q197 442 223 419T250 357Q250 340 236 301T196 196T154 83Q149 61 149 51Q149 26 166 26Q175 26 185 29T208 43T235 78T260 137Q263 149 265 151T282 153Q302 153 302 143Q302 135 293 112T268 61T223 11T161 -11Q129 -11 102 10T74 74Q74 91 79 106T122 220Q160 321 166 341T173 380Q173 404 156 404H154Q124 404 99 371T61 287Q60 286 59 284T58 281T56 279T53 278T49 278T41 278H27Q21 284 21 287Z"></path><path id="MJMAIN-36" stroke-width="1" d="M42 313Q42 476 123 571T303 666Q372 666 402 630T432 550Q432 525 418 510T379 495Q356 495 341 509T326 548Q326 592 373 601Q351 623 311 626Q240 626 194 566Q147 500 147 364L148 360Q153 366 156 373Q197 433 263 433H267Q313 433 348 414Q372 400 396 374T435 317Q456 268 456 210V192Q456 169 451 149Q440 90 387 34T253 -22Q225 -22 199 -14T143 16T92 75T56 172T42 313ZM257 397Q227 397 205 380T171 335T154 278T148 216Q148 133 160 97T198 39Q222 21 251 21Q302 21 329 59Q342 77 347 104T352 209Q352 289 347 316T329 361Q302 397 257 397Z"></path><path id="MJMAIN-37" stroke-width="1" d="M55 458Q56 460 72 567L88 674Q88 676 108 676H128V672Q128 662 143 655T195 646T364 644H485V605L417 512Q408 500 387 472T360 435T339 403T319 367T305 330T292 284T284 230T278 162T275 80Q275 66 275 52T274 28V19Q270 2 255 -10T221 -22Q210 -22 200 -19T179 0T168 40Q168 198 265 368Q285 400 349 489L395 552H302Q128 552 119 546Q113 543 108 522T98 479L95 458V455H55V458Z"></path><path id="MJMAIN-69" stroke-width="1" d="M69 609Q69 637 87 653T131 669Q154 667 171 652T188 609Q188 579 171 564T129 549Q104 549 87 564T69 609ZM247 0Q232 3 143 3Q132 3 106 3T56 1L34 0H26V46H42Q70 46 91 49Q100 53 102 60T104 102V205V293Q104 345 102 359T88 378Q74 385 41 385H30V408Q30 431 32 431L42 432Q52 433 70 434T106 436Q123 437 142 438T171 441T182 442H185V62Q190 52 197 50T232 46H255V0H247Z"></path><path id="MJMAIN-38" stroke-width="1" d="M70 417T70 494T124 618T248 666Q319 666 374 624T429 515Q429 485 418 459T392 417T361 389T335 371T324 363L338 354Q352 344 366 334T382 323Q457 264 457 174Q457 95 399 37T249 -22Q159 -22 101 29T43 155Q43 263 172 335L154 348Q133 361 127 368Q70 417 70 494ZM286 386L292 390Q298 394 301 396T311 403T323 413T334 425T345 438T355 454T364 471T369 491T371 513Q371 556 342 586T275 624Q268 625 242 625Q201 625 165 599T128 534Q128 511 141 492T167 463T217 431Q224 426 228 424L286 386ZM250 21Q308 21 350 55T392 137Q392 154 387 169T375 194T353 216T330 234T301 253T274 270Q260 279 244 289T218 306L210 311Q204 311 181 294T133 239T107 157Q107 98 150 60T250 21Z"></path><path id="MJMAIN-39" stroke-width="1" d="M352 287Q304 211 232 211Q154 211 104 270T44 396Q42 412 42 436V444Q42 537 111 606Q171 666 243 666Q245 666 249 666T257 665H261Q273 665 286 663T323 651T370 619T413 560Q456 472 456 334Q456 194 396 97Q361 41 312 10T208 -22Q147 -22 108 7T68 93T121 149Q143 149 158 135T173 96Q173 78 164 65T148 49T135 44L131 43Q131 41 138 37T164 27T206 22H212Q272 22 313 86Q352 142 352 280V287ZM244 248Q292 248 321 297T351 430Q351 508 343 542Q341 552 337 562T323 588T293 615T246 625Q208 625 181 598Q160 576 154 546T147 441Q147 358 152 329T172 282Q197 248 244 248Z"></path><path id="MJMAIN-79" stroke-width="1" d="M69 -66Q91 -66 104 -80T118 -116Q118 -134 109 -145T91 -160Q84 -163 97 -166Q104 -168 111 -168Q131 -168 148 -159T175 -138T197 -106T213 -75T225 -43L242 0L170 183Q150 233 125 297Q101 358 96 368T80 381Q79 382 78 382Q66 385 34 385H19V431H26L46 430Q65 430 88 429T122 428Q129 428 142 428T171 429T200 430T224 430L233 431H241V385H232Q183 385 185 366L286 112Q286 113 332 227L376 341V350Q376 365 366 373T348 383T334 385H331V431H337H344Q351 431 361 431T382 430T405 429T422 429Q477 429 503 431H508V385H497Q441 380 422 345Q420 343 378 235T289 9T227 -131Q180 -204 113 -204Q69 -204 44 -177T19 -116Q19 -89 35 -78T69 -66Z"></path><path id="MJMAIN-54" stroke-width="1" d="M36 443Q37 448 46 558T55 671V677H666V671Q667 666 676 556T685 443V437H645V443Q645 445 642 478T631 544T610 593Q593 614 555 625Q534 630 478 630H451H443Q417 630 414 618Q413 616 413 339V63Q420 53 439 50T528 46H558V0H545L361 3Q186 1 177 0H164V46H194Q264 46 283 49T309 63V339V550Q309 620 304 625T271 630H244H224Q154 630 119 601Q101 585 93 554T81 486T76 443V437H36V443Z"></path><path id="MJMAIN-2032" stroke-width="1" d="M79 43Q73 43 52 49T30 61Q30 68 85 293T146 528Q161 560 198 560Q218 560 240 545T262 501Q262 496 260 486Q259 479 173 263T84 45T79 43Z"></path><path id="MJMATHI-6F" stroke-width="1" d="M201 -11Q126 -11 80 38T34 156Q34 221 64 279T146 380Q222 441 301 441Q333 441 341 440Q354 437 367 433T402 417T438 387T464 338T476 268Q476 161 390 75T201 -11ZM121 120Q121 70 147 48T206 26Q250 26 289 58T351 142Q360 163 374 216T388 308Q388 352 370 375Q346 405 306 405Q243 405 195 347Q158 303 140 230T121 120Z"></path><path id="MJMATHI-6C" stroke-width="1" d="M117 59Q117 26 142 26Q179 26 205 131Q211 151 215 152Q217 153 225 153H229Q238 153 241 153T246 151T248 144Q247 138 245 128T234 90T214 43T183 6T137 -11Q101 -11 70 11T38 85Q38 97 39 102L104 360Q167 615 167 623Q167 626 166 628T162 632T157 634T149 635T141 636T132 637T122 637Q112 637 109 637T101 638T95 641T94 647Q94 649 96 661Q101 680 107 682T179 688Q194 689 213 690T243 693T254 694Q266 694 266 686Q266 675 193 386T118 83Q118 81 118 75T117 65V59Z"></path><path id="MJMATHI-64" stroke-width="1" d="M366 683Q367 683 438 688T511 694Q523 694 523 686Q523 679 450 384T375 83T374 68Q374 26 402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487H491Q506 153 506 145Q506 140 503 129Q490 79 473 48T445 8T417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157Q33 205 53 255T101 341Q148 398 195 420T280 442Q336 442 364 400Q369 394 369 396Q370 400 396 505T424 616Q424 629 417 632T378 637H357Q351 643 351 645T353 664Q358 683 366 683ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326Z"></path><path id="MJMATHI-3B7" stroke-width="1" d="M21 287Q22 290 23 295T28 317T38 348T53 381T73 411T99 433T132 442Q156 442 175 435T205 417T221 395T229 376L231 369Q231 367 232 367L243 378Q304 442 382 442Q436 442 469 415T503 336V326Q503 302 439 53Q381 -182 377 -189Q364 -216 332 -216Q319 -216 310 -208T299 -186Q299 -177 358 57L420 307Q423 322 423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 114 189T154 366Q154 405 128 405Q107 405 92 377T68 316T57 280Q55 278 41 278H27Q21 284 21 287Z"></path><path id="MJMAIN-2207" stroke-width="1" d="M46 676Q46 679 51 683H781Q786 679 786 676Q786 674 617 326T444 -26Q439 -33 416 -33T388 -26Q385 -22 216 326T46 676ZM697 596Q697 597 445 597T193 596Q195 591 319 336T445 80L697 596Z"></path><path id="MJMAIN-2208" stroke-width="1" d="M84 250Q84 372 166 450T360 539Q361 539 377 539T419 540T469 540H568Q583 532 583 520Q583 511 570 501L466 500Q355 499 329 494Q280 482 242 458T183 409T147 354T129 306T124 272V270H568Q583 262 583 250T568 230H124V228Q124 207 134 177T167 112T231 48T328 7Q355 1 466 0H570Q583 -10 583 -20Q583 -32 568 -40H471Q464 -40 446 -40T417 -41Q262 -41 172 45Q84 127 84 250Z"></path><path id="MJFRAK-52" stroke-width="1" d="M27 496Q31 569 102 627T234 685Q236 685 241 685T251 686Q287 686 318 672T367 638T399 598T418 564L423 550Q424 554 434 567T463 601T505 639T561 671T626 685Q672 685 688 659T710 572Q713 533 721 523T766 513Q781 513 787 514T794 516Q796 512 798 509T801 504T802 501T787 493Q702 461 624 401L607 389Q655 383 688 358L697 352V342Q699 330 699 297Q704 209 710 173T734 103Q751 69 765 69Q769 69 806 83L824 90V74Q823 73 759 24T693 -26Q692 -26 660 32L628 90L629 111Q631 159 631 177Q631 278 614 300Q584 340 523 340Q500 340 467 333T431 325Q429 325 429 322Q428 321 426 308T420 275T410 230T392 178T366 125L358 112L342 99Q306 70 269 38T213 -10T193 -26Q192 -26 163 0T116 26Q82 26 50 -8L42 -16L35 -8L27 0L35 10Q43 21 58 38T104 80T158 106Q179 106 218 65L235 48Q238 48 255 60T295 99T329 158Q352 231 352 359Q352 555 242 614Q210 628 187 628Q140 628 116 600T91 548Q91 522 138 464T185 382V376Q185 345 158 313T103 263L76 246Q74 244 64 253L54 260L65 267Q91 285 100 302Q111 318 111 337Q111 355 69 410T27 496ZM562 628Q504 628 443 507L435 491L436 479Q437 471 437 446Q437 396 432 351L529 389L602 426Q673 462 673 463H672Q644 470 637 483T622 553Q608 628 562 628Z"></path><path id="MJMATHI-4D" stroke-width="1" d="M289 629Q289 635 232 637Q208 637 201 638T194 648Q194 649 196 659Q197 662 198 666T199 671T201 676T203 679T207 681T212 683T220 683T232 684Q238 684 262 684T307 683Q386 683 398 683T414 678Q415 674 451 396L487 117L510 154Q534 190 574 254T662 394Q837 673 839 675Q840 676 842 678T846 681L852 683H948Q965 683 988 683T1017 684Q1051 684 1051 673Q1051 668 1048 656T1045 643Q1041 637 1008 637Q968 636 957 634T939 623Q936 618 867 340T797 59Q797 55 798 54T805 50T822 48T855 46H886Q892 37 892 35Q892 19 885 5Q880 0 869 0Q864 0 828 1T736 2Q675 2 644 2T609 1Q592 1 592 11Q592 13 594 25Q598 41 602 43T625 46Q652 46 685 49Q699 52 704 61Q706 65 742 207T813 490T848 631L654 322Q458 10 453 5Q451 4 449 3Q444 0 433 0Q418 0 415 7Q413 11 374 317L335 624L267 354Q200 88 200 79Q206 46 272 46H282Q288 41 289 37T286 19Q282 3 278 1Q274 0 267 0Q265 0 255 0T221 1T157 2Q127 2 95 1T58 0Q43 0 39 2T35 11Q35 13 38 25T43 40Q45 46 65 46Q135 46 154 86Q158 92 223 354T289 629Z"></path><path id="MJMAIN-5B" stroke-width="1" d="M118 -250V750H255V710H158V-210H255V-250H118Z"></path><path id="MJMATHI-6D" stroke-width="1" d="M21 287Q22 293 24 303T36 341T56 388T88 425T132 442T175 435T205 417T221 395T229 376L231 369Q231 367 232 367L243 378Q303 442 384 442Q401 442 415 440T441 433T460 423T475 411T485 398T493 385T497 373T500 364T502 357L510 367Q573 442 659 442Q713 442 746 415T780 336Q780 285 742 178T704 50Q705 36 709 31T724 26Q752 26 776 56T815 138Q818 149 821 151T837 153Q857 153 857 145Q857 144 853 130Q845 101 831 73T785 17T716 -10Q669 -10 648 17T627 73Q627 92 663 193T700 345Q700 404 656 404H651Q565 404 506 303L499 291L466 157Q433 26 428 16Q415 -11 385 -11Q372 -11 364 -4T353 8T350 18Q350 29 384 161L420 307Q423 322 423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 181Q151 335 151 342Q154 357 154 369Q154 405 129 405Q107 405 92 377T69 316T57 280Q55 278 41 278H27Q21 284 21 287Z"></path><path id="MJMAIN-5D" stroke-width="1" d="M22 710V750H159V-250H22V-210H119V710H22Z"></path><path id="MJSZ4-23A1" stroke-width="1" d="M319 -645V1154H666V1070H403V-645H319Z"></path><path id="MJSZ4-23A3" stroke-width="1" d="M319 -644V1155H403V-560H666V-644H319Z"></path><path id="MJSZ4-23A2" stroke-width="1" d="M319 0V602H403V0H319Z"></path><path id="MJSZ4-23A4" stroke-width="1" d="M0 1070V1154H347V-645H263V1070H0Z"></path><path id="MJSZ4-23A6" stroke-width="1" d="M263 -560V1155H347V-644H0V-560H263Z"></path><path id="MJSZ4-23A5" stroke-width="1" d="M263 0V602H347V0H263Z"></path><path id="MJMAIN-2202" stroke-width="1" d="M202 508Q179 508 169 520T158 547Q158 557 164 577T185 624T230 675T301 710L333 715H345Q378 715 384 714Q447 703 489 661T549 568T566 457Q566 362 519 240T402 53Q321 -22 223 -22Q123 -22 73 56Q42 102 42 148V159Q42 276 129 370T322 465Q383 465 414 434T455 367L458 378Q478 461 478 515Q478 603 437 639T344 676Q266 676 223 612Q264 606 264 572Q264 547 246 528T202 508ZM430 306Q430 372 401 400T333 428Q270 428 222 382Q197 354 183 323T150 221Q132 149 132 116Q132 21 232 21Q244 21 250 22Q327 35 374 112Q389 137 409 196T430 306Z"></path><path id="MJSZ1-2211" stroke-width="1" d="M61 748Q64 750 489 750H913L954 640Q965 609 976 579T993 533T999 516H979L959 517Q936 579 886 621T777 682Q724 700 655 705T436 710H319Q183 710 183 709Q186 706 348 484T511 259Q517 250 513 244L490 216Q466 188 420 134T330 27L149 -187Q149 -188 362 -188Q388 -188 436 -188T506 -189Q679 -189 778 -162T936 -43Q946 -27 959 6H999L913 -249L489 -250Q65 -250 62 -248Q56 -246 56 -239Q56 -234 118 -161Q186 -81 245 -11L428 206Q428 207 242 462L57 717L56 728Q56 744 61 748Z"></path><path id="MJMATHI-7A" stroke-width="1" d="M347 338Q337 338 294 349T231 360Q211 360 197 356T174 346T162 335T155 324L153 320Q150 317 138 317Q117 317 117 325Q117 330 120 339Q133 378 163 406T229 440Q241 442 246 442Q271 442 291 425T329 392T367 375Q389 375 411 408T434 441Q435 442 449 442H462Q468 436 468 434Q468 430 463 420T449 399T432 377T418 358L411 349Q368 298 275 214T160 106L148 94L163 93Q185 93 227 82T290 71Q328 71 360 90T402 140Q406 149 409 151T424 153Q443 153 443 143Q443 138 442 134Q425 72 376 31T278 -11Q252 -11 232 6T193 40T155 57Q111 57 76 -3Q70 -11 59 -11H54H41Q35 -5 35 -2Q35 13 93 84Q132 129 225 214T340 322Q352 338 347 338Z"></path><path id="MJMAIN-7B" stroke-width="1" d="M434 -231Q434 -244 428 -250H410Q281 -250 230 -184Q225 -177 222 -172T217 -161T213 -148T211 -133T210 -111T209 -84T209 -47T209 0Q209 21 209 53Q208 142 204 153Q203 154 203 155Q189 191 153 211T82 231Q71 231 68 234T65 250T68 266T82 269Q116 269 152 289T203 345Q208 356 208 377T209 529V579Q209 634 215 656T244 698Q270 724 324 740Q361 748 377 749Q379 749 390 749T408 750H428Q434 744 434 732Q434 719 431 716Q429 713 415 713Q362 710 332 689T296 647Q291 634 291 499V417Q291 370 288 353T271 314Q240 271 184 255L170 250L184 245Q202 239 220 230T262 196T290 137Q291 131 291 1Q291 -134 296 -147Q306 -174 339 -192T415 -213Q429 -213 431 -216Q434 -219 434 -231Z"></path><path id="MJMAIN-3E" stroke-width="1" d="M84 520Q84 528 88 533T96 539L99 540Q106 540 253 471T544 334L687 265Q694 260 694 250T687 235Q685 233 395 96L107 -40H101Q83 -38 83 -20Q83 -19 83 -17Q82 -10 98 -1Q117 9 248 71Q326 108 378 132L626 250L378 368Q90 504 86 509Q84 513 84 520Z"></path><path id="MJMATHI-74" stroke-width="1" d="M26 385Q19 392 19 395Q19 399 22 411T27 425Q29 430 36 430T87 431H140L159 511Q162 522 166 540T173 566T179 586T187 603T197 615T211 624T229 626Q247 625 254 615T261 596Q261 589 252 549T232 470L222 433Q222 431 272 431H323Q330 424 330 420Q330 398 317 385H210L174 240Q135 80 135 68Q135 26 162 26Q197 26 230 60T283 144Q285 150 288 151T303 153H307Q322 153 322 145Q322 142 319 133Q314 117 301 95T267 48T216 6T155 -11Q125 -11 98 4T59 56Q57 64 57 83V101L92 241Q127 382 128 383Q128 385 77 385H26Z"></path><path id="MJMATHI-72" stroke-width="1" d="M21 287Q22 290 23 295T28 317T38 348T53 381T73 411T99 433T132 442Q161 442 183 430T214 408T225 388Q227 382 228 382T236 389Q284 441 347 441H350Q398 441 422 400Q430 381 430 363Q430 333 417 315T391 292T366 288Q346 288 334 299T322 328Q322 376 378 392Q356 405 342 405Q286 405 239 331Q229 315 224 298T190 165Q156 25 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 114 189T154 366Q154 405 128 405Q107 405 92 377T68 316T57 280Q55 278 41 278H27Q21 284 21 287Z"></path><path id="MJMATHI-73" stroke-width="1" d="M131 289Q131 321 147 354T203 415T300 442Q362 442 390 415T419 355Q419 323 402 308T364 292Q351 292 340 300T328 326Q328 342 337 354T354 372T367 378Q368 378 368 379Q368 382 361 388T336 399T297 405Q249 405 227 379T204 326Q204 301 223 291T278 274T330 259Q396 230 396 163Q396 135 385 107T352 51T289 7T195 -10Q118 -10 86 19T53 87Q53 126 74 143T118 160Q133 160 146 151T160 120Q160 94 142 76T111 58Q109 57 108 57T107 55Q108 52 115 47T146 34T201 27Q237 27 263 38T301 66T318 97T323 122Q323 150 302 164T254 181T195 196T148 231Q131 256 131 289Z"></path><path id="MJSZ3-7B" stroke-width="1" d="M618 -943L612 -949H582L568 -943Q472 -903 411 -841T332 -703Q327 -682 327 -653T325 -350Q324 -28 323 -18Q317 24 301 61T264 124T221 171T179 205T147 225T132 234Q130 238 130 250Q130 255 130 258T131 264T132 267T134 269T139 272T144 275Q207 308 256 367Q310 436 323 519Q324 529 325 851Q326 1124 326 1154T332 1205Q369 1358 566 1443L582 1450H612L618 1444V1429Q618 1413 616 1411L608 1406Q599 1402 585 1393T552 1372T515 1343T479 1305T449 1257T429 1200Q425 1180 425 1152T423 851Q422 579 422 549T416 498Q407 459 388 424T346 364T297 318T250 284T214 264T197 254L188 251L205 242Q290 200 345 138T416 3Q421 -18 421 -48T423 -349Q423 -397 423 -472Q424 -677 428 -694Q429 -697 429 -699Q434 -722 443 -743T465 -782T491 -816T519 -845T548 -868T574 -886T595 -899T610 -908L616 -910Q618 -912 618 -928V-943Z"></path><path id="MJMAIN-2190" stroke-width="1" d="M944 261T944 250T929 230H165Q167 228 182 216T211 189T244 152T277 96T303 25Q308 7 308 0Q308 -11 288 -11Q281 -11 278 -11T272 -7T267 2T263 21Q245 94 195 151T73 236Q58 242 55 247Q55 254 59 257T73 264Q121 283 158 314T215 375T247 434T264 480L267 497Q269 503 270 505T275 509T288 511Q308 511 308 500Q308 493 303 475Q293 438 278 406T246 352T215 315T185 287T165 270H929Q944 261 944 250Z"></path></defs></svg></div><div id="MathJax_Message" style="display: none;"></div><div class="pace  pace-inactive"><div class="pace-progress" data-progress-text="100%" data-progress="99" style="width: 100%;">
  <div class="pace-progress-inner"></div>
</div>
<div class="pace-activity"></div></div>

    <div id="global-prompt-alert" class="hide alert alert-warning">
        <span id="global-prompt-message"></span>
        <a id="close-global-prompt-alert" href="https://www.zybuluo.com/hanbingtao/note/448086">[关闭]</a>
    </div>

    <!-- zybuluo's body -->
    







<!-- mdeditor's body -->






<div id="editor-reader-full" class="editor-reader-full-shown" style="position: static; padding-right: 75px;">
    <div id="reader-full-topInfo" class="reader-full-topInfo-shown">
        <span>
            <code>@hanbingtao</code>
        </span>
        <code><span class="article-updated-date">2017-08-28 19:40</span></code>
        <code><span>字数 </span><span class="article-characters">9931</span></code>
        <code><span>阅读 </span><span class="article-read">158586</span></code>
    </div>
    <div id="wmd-preview" class="wmd-preview wmd-preview-full-reader" data-medium-element="true" style="left: 0px;"><div class="md-section-divider"></div><div class="md-section-divider"></div><h1 data-anchor-id="0s4w" id="零基础入门深度学习2-线性单元和梯度下降">零基础入门深度学习(2) - 线性单元和梯度下降</h1><p data-anchor-id="0jag"><code>机器学习</code> <code>深度学习入门</code></p><hr><p data-anchor-id="hyta"><img src="./零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器_files/2256672-06627c71f0d8c0dc.jpg" alt=""></p><blockquote data-anchor-id="mweo" class="white-blockquote">
  <p>无论即将到来的是大数据时代还是人工智能时代，亦或是传统行业使用人工智能在云上处理大数据的时代，作为一个有理想有追求的程序员，不懂深度学习（Deep Learning）这个超热的技术，会不会感觉马上就out了？现在救命稻草来了，《零基础入门深度学习》系列文章旨在讲帮助爱编程的你从零基础达到入门级水平。零基础意味着你不需要太多的数学知识，只要会写程序就行了，没错，这是专门为程序员写的文章。虽然文中会有很多公式你也许看不懂，但同时也会有更多的代码，程序员的你一定能看懂的（我周围是一群狂热的Clean Code程序员，所以我写的代码也不会很差）。</p>
</blockquote><div class="md-section-divider"></div><h2 data-anchor-id="odhz" id="文章列表">文章列表</h2><p data-anchor-id="qtus"><a href="https://www.zybuluo.com/hanbingtao/note/433855" target="_blank">零基础入门深度学习(1) - 感知器</a> <br>
<a href="https://www.zybuluo.com/hanbingtao/note/448086" target="_blank">零基础入门深度学习(2) - 线性单元和梯度下降</a> <br>
<a href="https://www.zybuluo.com/hanbingtao/note/476663" target="_blank">零基础入门深度学习(3) - 神经网络和反向传播算法</a> <br>
<a href="https://www.zybuluo.com/hanbingtao/note/485480" target="_blank">零基础入门深度学习(4) - 卷积神经网络</a> <br>
<a href="https://zybuluo.com/hanbingtao/note/541458" target="_blank">零基础入门深度学习(5) - 循环神经网络</a> <br>
<a href="https://zybuluo.com/hanbingtao/note/581764" target="_blank">零基础入门深度学习(6) - 长短时记忆网络(LSTM)</a> <br>
<a href="https://zybuluo.com/hanbingtao/note/626300" target="_blank">零基础入门深度学习(7) - 递归神经网络</a></p><div class="md-section-divider"></div><h2 data-anchor-id="wvb4" id="往期回顾">往期回顾</h2><p data-anchor-id="oftw">在上一篇文章中，我们已经学会了编写一个简单的感知器，并用它来实现一个线性分类器。你应该还记得用来训练感知器的『感知器规则』。然而，我们并没有关心这个规则是怎么得到的。本文通过介绍另外一种『感知器』，也就是『线性单元』，来说明关于机器学习一些基本的概念，比如模型、目标函数、优化算法等等。这些概念对于所有的机器学习算法来说都是通用的，掌握了这些概念，就掌握了机器学习的基本套路。</p><div class="md-section-divider"></div><h2 data-anchor-id="xmsb" id="线性单元是啥">线性单元是啥</h2><p data-anchor-id="oks1">感知器有一个问题，当面对的数据集不是<strong>线性可分</strong>的时候，『感知器规则』可能无法收敛，这意味着我们永远也无法完成一个感知器的训练。为了解决这个问题，我们使用一个<strong>可导</strong>的<strong>线性函数</strong>来替代感知器的<strong>阶跃函数</strong>，这种感知器就叫做<strong>线性单元</strong>。线性单元在面对线性不可分的数据集时，会收敛到一个最佳的近似上。</p><p data-anchor-id="aicn">为了简单起见，我们可以设置线性单元的激活函数<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-1-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -725.2000693679926 550.5 950.4001387359851" style="width: 1.331ex; height: 2.177ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-66"></use></g></svg></span><script type="math/tex" id="MathJax-Element-1">f</script>为</p><div class="md-section-divider"></div><p data-anchor-id="raas"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-2-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 3808.5555555555557 1040.4001387359851" style="width: 8.831ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-66"></use><use href="#MJMAIN-28" x="550" y="0"></use><use href="#MJMATHI-78" x="940" y="0"></use><use href="#MJMAIN-29" x="1512" y="0"></use><use href="#MJMAIN-3D" x="2179" y="0"></use><use href="#MJMATHI-78" x="3236" y="0"></use></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-2">
f(x)=x
</script><p></p><p data-anchor-id="qs9m">这样的线性单元如下图所示</p><p data-anchor-id="is43"><img src="./零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器_files/2256672-f57602e423d739ee.png" alt="" title=""></p><p data-anchor-id="872p">对比此前我们讲过的感知器</p><p data-anchor-id="pqy7"><img src="./零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器_files/2256672-801d65e79bfc3162.png" alt="" title=""></p><p data-anchor-id="xglz">这样替换了激活函数<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-3-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -725.2000693679926 550.5 950.4001387359851" style="width: 1.331ex; height: 2.177ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-66"></use></g></svg></span><script type="math/tex" id="MathJax-Element-3">f</script>之后，<strong>线性单元</strong>将返回一个<strong>实数值</strong>而不是<strong>0,1分类</strong>。因此线性单元用来解决<strong>回归</strong>问题而不是<strong>分类</strong>问题。</p><div class="md-section-divider"></div><h3 data-anchor-id="wn30" id="线性单元的模型">线性单元的模型</h3><p data-anchor-id="1cd0">当我们说<strong>模型</strong>时，我们实际上在谈论根据输入<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-4-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 572.5 493.40013873598514" style="width: 1.331ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use></g></svg></span><script type="math/tex" id="MathJax-Element-4">x</script>预测输出<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-5-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-5">y</script>的<strong>算法</strong>。比如，<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-6-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 572.5 493.40013873598514" style="width: 1.331ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use></g></svg></span><script type="math/tex" id="MathJax-Element-6">x</script>可以是一个人的工作年限，<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-7-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-7">y</script>可以是他的月薪，我们可以用某种算法来根据一个人的工作年限来预测他的收入。比如：</p><div class="md-section-divider"></div><p data-anchor-id="ziuq"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-8-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 8980.000000000002 1040.4001387359851" style="width: 20.806ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use><use href="#MJMAIN-3D" x="775" y="0"></use><use href="#MJMATHI-68" x="1831" y="0"></use><use href="#MJMAIN-28" x="2408" y="0"></use><use href="#MJMATHI-78" x="2797" y="0"></use><use href="#MJMAIN-29" x="3370" y="0"></use><use href="#MJMAIN-3D" x="4037" y="0"></use><use href="#MJMATHI-77" x="5093" y="0"></use><use href="#MJMAIN-2217" x="6032" y="0"></use><use href="#MJMATHI-78" x="6755" y="0"></use><use href="#MJMAIN-2B" x="7549" y="0"></use><use href="#MJMATHI-62" x="8550" y="0"></use></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-8">y=h(x)=w*x+b</script><p></p><p data-anchor-id="wqf4">函数<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-9-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 1928 1040.4001387359851" style="width: 4.476ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-68"></use><use href="#MJMAIN-28" x="576" y="0"></use><use href="#MJMATHI-78" x="966" y="0"></use><use href="#MJMAIN-29" x="1538" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-9">h(x)</script>叫做<strong>假设</strong>，而<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-10-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 716.5 494.40013873598514" style="width: 1.694ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-77"></use></g></svg></span><script type="math/tex" id="MathJax-Element-10">w</script>、<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-11-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -714.2000693679926 429.5 745.4001387359851" style="width: 0.968ex; height: 1.694ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-62"></use></g></svg></span><script type="math/tex" id="MathJax-Element-11">b</script>是它的<strong>参数</strong>。我们假设参数<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-12-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -686.2000693679926 4052.5555555555557 728.4001387359851" style="width: 9.435ex; height: 1.694ex; vertical-align: -0.242ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-77"></use><use href="#MJMAIN-3D" x="994" y="0"></use><g transform="translate(2050,0)"><use href="#MJMAIN-31"></use><use href="#MJMAIN-30" x="500" y="0"></use><use href="#MJMAIN-30" x="1001" y="0"></use><use href="#MJMAIN-30" x="1501" y="0"></use></g></g></svg></span><script type="math/tex" id="MathJax-Element-12">w=1000</script>，参数<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-13-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -714.2000693679926 3265.0555555555557 756.4001387359851" style="width: 7.621ex; height: 1.815ex; vertical-align: -0.242ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-62"></use><use href="#MJMAIN-3D" x="707" y="0"></use><g transform="translate(1763,0)"><use href="#MJMAIN-35"></use><use href="#MJMAIN-30" x="500" y="0"></use><use href="#MJMAIN-30" x="1001" y="0"></use></g></g></svg></span><script type="math/tex" id="MathJax-Element-13">b=500</script>，如果一个人的工作年限是5年的话，我们的模型会预测他的月薪为</p><div class="md-section-divider"></div><p data-anchor-id="e3ap"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-14-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -904.613537109928 16213.885878136201 1288.3956226069529" style="width: 37.621ex; height: 3.024ex; vertical-align: -0.968ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use><use href="#MJMAIN-3D" x="775" y="0"></use><use href="#MJMATHI-68" x="1831" y="0"></use><use href="#MJMAIN-28" x="2408" y="0"></use><use href="#MJMATHI-78" x="2797" y="0"></use><use href="#MJMAIN-29" x="3370" y="0"></use><use href="#MJMAIN-3D" x="4037" y="0"></use><g transform="translate(5093,0)"><use href="#MJMAIN-31"></use><use href="#MJMAIN-30" x="500" y="0"></use><use href="#MJMAIN-30" x="1001" y="0"></use><use href="#MJMAIN-30" x="1501" y="0"></use></g><use href="#MJMAIN-2217" x="7317" y="0"></use><use href="#MJMAIN-35" x="8040" y="0"></use><use href="#MJMAIN-2B" x="8763" y="0"></use><g transform="translate(9764,0)"><use href="#MJMAIN-35"></use><use href="#MJMAIN-30" x="500" y="0"></use><use href="#MJMAIN-30" x="1001" y="0"></use></g><use href="#MJMAIN-3D" x="11543" y="0"></use><g transform="translate(12599,0)"><use href="#MJMAIN-35"></use><use href="#MJMAIN-35" x="500" y="0"></use><use href="#MJMAIN-30" x="1001" y="0"></use><use href="#MJMAIN-30" x="1501" y="0"></use></g><use href="#MJMAIN-28" x="14601" y="0"></use><g transform="translate(14991,0)"><text font-family="STIXGeneral,&#39;Arial Unicode MS&#39;,serif" font-style="" font-weight="" stroke="none" transform="scale(52.08314516129032) matrix(1 0 0 -1 0 0)">元</text></g><use href="#MJMAIN-29" x="15824" y="0"></use></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-14">y=h(x)=1000*5+500=5500(元)</script><p></p><p data-anchor-id="8mmg">你也许会说，这个模型太不靠谱了。是这样的，因为我们考虑的因素太少了，仅仅包含了工作年限。如果考虑更多的因素，比如所处的行业、公司、职级等等，可能预测就会靠谱的多。我们把工作年限、行业、公司、职级这些信息，称之为<strong>特征</strong>。对于一个工作了5年，在IT行业，百度工作，职级T6这样的人，我们可以用这样的一个特征向量来表示他</p><p data-anchor-id="rdsk"><span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-15-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 528.5 471.40013873598514" style="width: 1.21ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-78"></use></g></svg></span><script type="math/tex" id="MathJax-Element-15">\mathrm{x}</script> = <em>(5, IT, 百度, T6)</em>。</p><p data-anchor-id="fmrf">既然输入<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-16-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 528.5 471.40013873598514" style="width: 1.21ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-78"></use></g></svg></span><script type="math/tex" id="MathJax-Element-16">\mathrm{x}</script>变成了一个具备四个特征的向量，相对应的，仅仅一个参数<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-17-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 716.5 494.40013873598514" style="width: 1.694ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-77"></use></g></svg></span><script type="math/tex" id="MathJax-Element-17">w</script>就不够用了，我们应该使用4个参数<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-18-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 6017.127775935468 678.4001387359851" style="width: 14.032ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1013" y="-213"></use><use href="#MJMAIN-2C" x="1170" y="0"></use><g transform="translate(1615,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="1013" y="-213"></use></g><use href="#MJMAIN-2C" x="2785" y="0"></use><g transform="translate(3231,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-33" x="1013" y="-213"></use></g><use href="#MJMAIN-2C" x="4401" y="0"></use><g transform="translate(4846,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-34" x="1013" y="-213"></use></g></g></svg></span><script type="math/tex" id="MathJax-Element-18">w_1,w_2,w_3,w_4</script>，每个特征对应一个。这样，我们的模型就变成</p><div class="md-section-divider"></div><p data-anchor-id="vuc0"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-19-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 22981.922218537613 1040.4001387359851" style="width: 53.347ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use><use href="#MJMAIN-3D" x="775" y="0"></use><use href="#MJMATHI-68" x="1831" y="0"></use><use href="#MJMAIN-28" x="2408" y="0"></use><use href="#MJMATHI-78" x="2797" y="0"></use><use href="#MJMAIN-29" x="3370" y="0"></use><use href="#MJMAIN-3D" x="4037" y="0"></use><g transform="translate(5093,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1013" y="-213"></use></g><use href="#MJMAIN-2217" x="6486" y="0"></use><g transform="translate(7208,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="809" y="-213"></use></g><use href="#MJMAIN-2B" x="8457" y="0"></use><g transform="translate(9458,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="1013" y="-213"></use></g><use href="#MJMAIN-2217" x="10850" y="0"></use><g transform="translate(11573,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="809" y="-213"></use></g><use href="#MJMAIN-2B" x="12822" y="0"></use><g transform="translate(13823,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-33" x="1013" y="-213"></use></g><use href="#MJMAIN-2217" x="15215" y="0"></use><g transform="translate(15938,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-33" x="809" y="-213"></use></g><use href="#MJMAIN-2B" x="17186" y="0"></use><g transform="translate(18187,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-34" x="1013" y="-213"></use></g><use href="#MJMAIN-2217" x="19580" y="0"></use><g transform="translate(20303,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-34" x="809" y="-213"></use></g><use href="#MJMAIN-2B" x="21551" y="0"></use><use href="#MJMATHI-62" x="22552" y="0"></use></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-19">y=h(x)=w_1*x_1+w_2*x_2+w_3*x_3+w_4*x_4+b</script><p></p><p data-anchor-id="ji69">其中，<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-20-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 1026.406943983867 632.1072455171717" style="width: 2.419ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="809" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-20">x_1</script>对应工作年限，<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-21-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 1026.406943983867 632.1072455171717" style="width: 2.419ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="809" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-21">x_2</script>对应行业，<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-22-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 1026.406943983867 647.6635947032757" style="width: 2.419ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-33" x="809" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-22">x_3</script>对应公司，<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-23-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 1026.406943983867 632.1072455171717" style="width: 2.419ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-34" x="809" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-23">x_4</script>对应职级。</p><p data-anchor-id="6fwl">为了书写和计算方便，我们可以令<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-24-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 1170.406943983867 648.6635947032757" style="width: 2.661ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-30" x="1013" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-24">w_0</script>等于<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-25-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -714.2000693679926 429.5 745.4001387359851" style="width: 0.968ex; height: 1.694ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-62"></use></g></svg></span><script type="math/tex" id="MathJax-Element-25">b</script>，同时令<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-26-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 1170.406943983867 648.6635947032757" style="width: 2.661ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-30" x="1013" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-26">w_0</script>对应于特征<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-27-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 1026.406943983867 647.6635947032757" style="width: 2.419ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-30" x="809" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-27">x_0</script>。由于<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-28-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 1026.406943983867 647.6635947032757" style="width: 2.419ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-30" x="809" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-28">x_0</script>其实并不存在，我们可以令它的值永远为1。也就是说</p><div class="md-section-divider"></div><p data-anchor-id="y0wr"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-29-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -904.613537109928 11432.937032668446 1288.3956226069529" style="width: 26.613ex; height: 3.024ex; vertical-align: -0.968ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-62"></use><use href="#MJMAIN-3D" x="707" y="0"></use><g transform="translate(1763,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-30" x="1013" y="-213"></use></g><use href="#MJMAIN-2217" x="3156" y="0"></use><g transform="translate(3878,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-30" x="809" y="-213"></use></g><g transform="translate(6905,0)"><text font-family="STIXGeneral,&#39;Arial Unicode MS&#39;,serif" font-style="" font-weight="" stroke="none" transform="scale(52.08314516129032) matrix(1 0 0 -1 0 0)">其</text></g><g transform="translate(7738,0)"><text font-family="STIXGeneral,&#39;Arial Unicode MS&#39;,serif" font-style="" font-weight="" stroke="none" transform="scale(52.08314516129032) matrix(1 0 0 -1 0 0)">中</text></g><g transform="translate(8571,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-30" x="809" y="-213"></use></g><use href="#MJMAIN-3D" x="9876" y="0"></use><use href="#MJMAIN-31" x="10932" y="0"></use></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-29">
b = w_0 * x_0\qquad其中x_0=1
</script><p></p><p data-anchor-id="cppd">这样上面的式子就可以写成</p><div class="md-section-divider"></div><p data-anchor-id="ft42"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-30-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -1445.7000693679925 44270.673387096766 2391.400138735985" style="width: 102.823ex; height: 5.565ex; vertical-align: -2.298ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(9462,0)"><g transform="translate(-15,0)"><g transform="translate(0,626)"><use href="#MJMATHI-79"></use><use href="#MJMAIN-3D" x="775" y="0"></use><use href="#MJMATHI-68" x="1831" y="0"></use><use href="#MJMAIN-28" x="2408" y="0"></use><use href="#MJMATHI-78" x="2797" y="0"></use><use href="#MJMAIN-29" x="3370" y="0"></use></g></g><g transform="translate(4023,0)"><g transform="translate(0,626)"><use href="#MJMAIN-3D"></use><g transform="translate(1056,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1013" y="-213"></use></g><use href="#MJMAIN-2217" x="2448" y="0"></use><g transform="translate(3171,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="809" y="-213"></use></g><use href="#MJMAIN-2B" x="4420" y="0"></use><g transform="translate(5420,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="1013" y="-213"></use></g><use href="#MJMAIN-2217" x="6813" y="0"></use><g transform="translate(7536,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="809" y="-213"></use></g><use href="#MJMAIN-2B" x="8784" y="0"></use><g transform="translate(9785,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-33" x="1013" y="-213"></use></g><use href="#MJMAIN-2217" x="11178" y="0"></use><g transform="translate(11901,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-33" x="809" y="-213"></use></g><use href="#MJMAIN-2B" x="13149" y="0"></use><g transform="translate(14150,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-34" x="1013" y="-213"></use></g><use href="#MJMAIN-2217" x="15543" y="0"></use><g transform="translate(16265,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-34" x="809" y="-213"></use></g><use href="#MJMAIN-2B" x="17514" y="0"></use><use href="#MJMATHI-62" x="18515" y="0"></use></g><g transform="translate(0,-676)"><use href="#MJMAIN-3D"></use><g transform="translate(1056,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-30" x="1013" y="-213"></use></g><use href="#MJMAIN-2217" x="2448" y="0"></use><g transform="translate(3171,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-30" x="809" y="-213"></use></g><use href="#MJMAIN-2B" x="4420" y="0"></use><g transform="translate(5420,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1013" y="-213"></use></g><use href="#MJMAIN-2217" x="6813" y="0"></use><g transform="translate(7536,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="809" y="-213"></use></g><use href="#MJMAIN-2B" x="8784" y="0"></use><g transform="translate(9785,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="1013" y="-213"></use></g><use href="#MJMAIN-2217" x="11178" y="0"></use><g transform="translate(11901,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="809" y="-213"></use></g><use href="#MJMAIN-2B" x="13149" y="0"></use><g transform="translate(14150,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-33" x="1013" y="-213"></use></g><use href="#MJMAIN-2217" x="15543" y="0"></use><g transform="translate(16265,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-33" x="809" y="-213"></use></g><use href="#MJMAIN-2B" x="17514" y="0"></use><g transform="translate(18515,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-34" x="1013" y="-213"></use></g><use href="#MJMAIN-2217" x="19907" y="0"></use><g transform="translate(20630,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-34" x="809" y="-213"></use></g></g></g></g><g transform="translate(42191,0)"><g transform="translate(0,626)"><g id="mjx-eqn-1"><use href="#MJMAIN-28"></use><use href="#MJMAIN-31" x="389" y="0"></use><use href="#MJMAIN-29" x="890" y="0"></use></g></g><g transform="translate(0,-676)"><g id="mjx-eqn-2"><use href="#MJMAIN-28"></use><use href="#MJMAIN-32" x="389" y="0"></use><use href="#MJMAIN-29" x="890" y="0"></use></g></g></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-30">
\begin{align}
y=h(x)&=w_1*x_1+w_2*x_2+w_3*x_3+w_4*x_4+b\\
&=w_0*x_0+w_1*x_1+w_2*x_2+w_3*x_3+w_4*x_4
\end{align}
</script><p></p><p data-anchor-id="wa02">我们还可以把上式写成向量的形式</p><div class="md-section-divider"></div><p data-anchor-id="d02m"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-31-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -911.5104670124718 13055.598161037678 1295.2925525094968" style="width: 30.363ex; height: 3.024ex; vertical-align: -0.968ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use><use href="#MJMAIN-3D" x="775" y="0"></use><use href="#MJMATHI-68" x="1831" y="0"></use><use href="#MJMAIN-28" x="2408" y="0"></use><use href="#MJMATHI-78" x="2797" y="0"></use><use href="#MJMAIN-29" x="3370" y="0"></use><use href="#MJMAIN-3D" x="4037" y="0"></use><g transform="translate(5093,0)"><use href="#MJMAIN-77"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-54" x="1021" y="583"></use></g><use href="#MJMAIN-78" x="6414" y="0"></use><use href="#MJMAIN-28" x="10942" y="0"></use><g transform="translate(11332,0)"><text font-family="STIXGeneral,&#39;Arial Unicode MS&#39;,serif" font-style="" font-weight="" stroke="none" transform="scale(52.08314516129032) matrix(1 0 0 -1 0 0)">式</text></g><use href="#MJMAIN-31" x="12165" y="0"></use><use href="#MJMAIN-29" x="12666" y="0"></use></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-31">y=h(x)=\mathrm{w}^T\mathrm{x}\qquad\qquad(式1)</script><p></p><p data-anchor-id="pm94">长成这种样子模型就叫做<strong>线性模型</strong>，因为输出<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-32-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-32">y</script>就是输入特征<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-33-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 5583.554165284935 677.4001387359851" style="width: 12.944ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="809" y="-213"></use><use href="#MJMAIN-2C" x="1026" y="0"></use><g transform="translate(1471,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="809" y="-213"></use></g><use href="#MJMAIN-2C" x="2497" y="0"></use><g transform="translate(2943,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-33" x="809" y="-213"></use></g><use href="#MJMAIN-2C" x="3969" y="0"></use><use href="#MJMAIN-2E" x="4414" y="0"></use><use href="#MJMAIN-2E" x="4859" y="0"></use><use href="#MJMAIN-2E" x="5305" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-33">x_1,x_2,x_3,...</script>的<strong>线性组合</strong>。</p><div class="md-section-divider"></div><h3 data-anchor-id="ayjr" id="监督学习和无监督学习">监督学习和无监督学习</h3><p data-anchor-id="sire">接下来，我们需要关心的是这个模型如何训练，也就是参数<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-34-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 722.5 482.40013873598514" style="width: 1.694ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-77"></use></g></svg></span><script type="math/tex" id="MathJax-Element-34">\mathrm{w}</script>取什么值最合适。</p><p data-anchor-id="cv41">机器学习有一类学习方法叫做<strong>监督学习</strong>，它是说为了训练一个模型，我们要提供这样一堆训练样本：每个训练样本既包括输入特征<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-35-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 528.5 471.40013873598514" style="width: 1.21ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-78"></use></g></svg></span><script type="math/tex" id="MathJax-Element-35">\mathrm{x}</script>，也包括对应的输出<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-36-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-36">y</script>(<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-37-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-37">y</script>也叫做<strong>标记，label</strong>)。也就是说，我们要找到很多人，我们既知道他们的特征(工作年限，行业...)，也知道他们的收入。我们用这样的样本去训练模型，让模型既看到我们提出的每个问题(输入特征<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-38-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 528.5 471.40013873598514" style="width: 1.21ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-78"></use></g></svg></span><script type="math/tex" id="MathJax-Element-38">\mathrm{x}</script>)，也看到对应问题的答案(标记<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-39-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-39">y</script>)。当模型看到足够多的样本之后，它就能总结出其中的一些规律。然后，就可以预测那些它没看过的输入所对应的答案了。</p><p data-anchor-id="e68r">另外一类学习方法叫做<strong>无监督学习</strong>，这种方法的训练样本中只有<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-40-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 528.5 471.40013873598514" style="width: 1.21ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-78"></use></g></svg></span><script type="math/tex" id="MathJax-Element-40">\mathrm{x}</script>而没有<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-41-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-41">y</script>。模型可以总结出特征<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-42-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 528.5 471.40013873598514" style="width: 1.21ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-78"></use></g></svg></span><script type="math/tex" id="MathJax-Element-42">\mathrm{x}</script>的一些规律，但是无法知道其对应的答案<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-43-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-43">y</script>。</p><p data-anchor-id="4d8e">很多时候，既有<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-44-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 528.5 471.40013873598514" style="width: 1.21ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-78"></use></g></svg></span><script type="math/tex" id="MathJax-Element-44">\mathrm{x}</script>又有<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-45-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-45">y</script>的训练样本是很少的，大部分样本都只有<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-46-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 528.5 471.40013873598514" style="width: 1.21ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-78"></use></g></svg></span><script type="math/tex" id="MathJax-Element-46">\mathrm{x}</script>。比如在语音到文本(STT)的识别任务中，<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-47-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 528.5 471.40013873598514" style="width: 1.21ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-78"></use></g></svg></span><script type="math/tex" id="MathJax-Element-47">\mathrm{x}</script>是语音，<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-48-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-48">y</script>是这段语音对应的文本。我们很容易获取大量的语音录音，然而把语音一段一段切分好并<strong>标注</strong>上对应文字则是非常费力气的事情。这种情况下，为了弥补带标注样本的不足，我们可以用<strong>无监督学习方法</strong>先做一些<strong>聚类</strong>，让模型总结出哪些音节是相似的，然后再用少量的带标注的训练样本，告诉模型其中一些音节对应的文字。这样模型就可以把相似的音节都对应到相应文字上，完成模型的训练。</p><div class="md-section-divider"></div><h3 data-anchor-id="hjsi" id="线性单元的目标函数">线性单元的目标函数</h3><p data-anchor-id="bsh7">现在，让我们只考虑<strong>监督学习</strong>。</p><p data-anchor-id="52yu">在监督学习下，对于一个样本，我们知道它的特征<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-49-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 528.5 471.40013873598514" style="width: 1.21ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-78"></use></g></svg></span><script type="math/tex" id="MathJax-Element-49">\mathrm{x}</script>，以及标记<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-50-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-50">y</script>。同时，我们还可以根据模型<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-51-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 1928 1040.4001387359851" style="width: 4.476ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-68"></use><use href="#MJMAIN-28" x="576" y="0"></use><use href="#MJMATHI-78" x="966" y="0"></use><use href="#MJMAIN-29" x="1538" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-51">h(x)</script>计算得到输出<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-52-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -589.324787109928 560.675 814.5248564779206" style="width: 1.331ex; height: 1.935ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use></g></svg></span><script type="math/tex" id="MathJax-Element-52">\bar{y}</script>。注意这里面我们用<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-53-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-53">y</script>表示训练样本里面的<strong>标记</strong>，也就是<strong>实际值</strong>；用带上划线的<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-54-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -589.324787109928 560.675 814.5248564779206" style="width: 1.331ex; height: 1.935ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use></g></svg></span><script type="math/tex" id="MathJax-Element-54">\bar{y}</script>表示模型计算的出来的<strong>预测值</strong>。我们当然希望模型计算出来的<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-55-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -589.324787109928 560.675 814.5248564779206" style="width: 1.331ex; height: 1.935ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use></g></svg></span><script type="math/tex" id="MathJax-Element-55">\bar{y}</script>和<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-56-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-56">y</script>越接近越好。</p><p data-anchor-id="yde6">数学上有很多方法来表示的<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-57-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -589.324787109928 560.675 814.5248564779206" style="width: 1.331ex; height: 1.935ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use></g></svg></span><script type="math/tex" id="MathJax-Element-57">\bar{y}</script>和<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-58-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-58">y</script>的接近程度，比如我们可以用<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-59-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -589.324787109928 560.675 814.5248564779206" style="width: 1.331ex; height: 1.935ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use></g></svg></span><script type="math/tex" id="MathJax-Element-59">\bar{y}</script>和<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-60-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-60">y</script>的差的平方的<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-61-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -899.2032963780257 713.906943983867 1298.4065927560514" style="width: 1.694ex; height: 3.024ex; vertical-align: -0.968ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(120,0)"><rect stroke="none" width="473" height="60" x="0" y="220"></rect><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="84" y="577"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="84" y="-537"></use></g></g></svg></span><script type="math/tex" id="MathJax-Element-61">\frac{1}{2}</script>来表示它们的接近程度</p><div class="md-section-divider"></div><p data-anchor-id="2zyw"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-62-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -1362.7080693679925 6341.748610650534 2068.859138735985" style="width: 14.758ex; height: 4.839ex; vertical-align: -1.694ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-65"></use><use href="#MJMAIN-3D" x="744" y="0"></use><g transform="translate(1920,0)"><rect stroke="none" width="620" height="60" x="0" y="220"></rect><use href="#MJMAIN-31" x="60" y="676"></use><use href="#MJMAIN-32" x="60" y="-686"></use></g><use href="#MJMAIN-28" x="2827" y="0"></use><use href="#MJMATHI-79" x="3217" y="0"></use><use href="#MJMAIN-2212" x="3936" y="0"></use><g transform="translate(4937,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use></g><g transform="translate(5498,0)"><use href="#MJMAIN-29"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="550" y="583"></use></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-62">
e=\frac{1}{2}(y-\bar{y})^2
</script><p></p><p data-anchor-id="ub0y">我们把<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-63-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 466.5 494.40013873598514" style="width: 1.089ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-65"></use></g></svg></span><script type="math/tex" id="MathJax-Element-63">e</script>叫做<strong>单个样本</strong>的<strong>误差</strong>。至于为什么前面要乘<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-64-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -899.2032963780257 713.906943983867 1298.4065927560514" style="width: 1.694ex; height: 3.024ex; vertical-align: -0.968ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(120,0)"><rect stroke="none" width="473" height="60" x="0" y="220"></rect><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="84" y="577"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="84" y="-537"></use></g></g></svg></span><script type="math/tex" id="MathJax-Element-64">\frac{1}{2}</script>，是为了后面计算方便。</p><p data-anchor-id="vudw">训练数据中会有很多样本，比如<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-65-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -703.2000693679926 888.5 723.4001387359851" style="width: 2.056ex; height: 1.694ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-4E"></use></g></svg></span><script type="math/tex" id="MathJax-Element-65">N</script>个，我们可以用训练数据中<strong>所有样本</strong>的误差的<strong>和</strong>，来表示模型的误差<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-66-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -700.2000693679926 764.5 720.4001387359851" style="width: 1.815ex; height: 1.694ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-45"></use></g></svg></span><script type="math/tex" id="MathJax-Element-66">E</script>，也就是</p><div class="md-section-divider"></div><p data-anchor-id="usyo"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-67-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -963.1292620390899 13392.62762867585 1065.3293314070825" style="width: 31.089ex; height: 2.419ex; vertical-align: -0.363ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-45"></use><use href="#MJMAIN-3D" x="1042" y="0"></use><g transform="translate(2098,0)"><use href="#MJMATHI-65"></use><g transform="translate(466,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="890" y="0"></use></g></g><use href="#MJMAIN-2B" x="3792" y="0"></use><g transform="translate(4792,0)"><use href="#MJMATHI-65"></use><g transform="translate(466,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="890" y="0"></use></g></g><use href="#MJMAIN-2B" x="6486" y="0"></use><g transform="translate(7486,0)"><use href="#MJMATHI-65"></use><g transform="translate(466,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-33" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="890" y="0"></use></g></g><use href="#MJMAIN-2B" x="8958" y="0"></use><use href="#MJMAIN-2E" x="9736" y="0"></use><use href="#MJMAIN-2E" x="10181" y="0"></use><use href="#MJMAIN-2E" x="10627" y="0"></use><use href="#MJMAIN-2B" x="11072" y="0"></use><g transform="translate(11850,0)"><use href="#MJMATHI-65"></use><g transform="translate(466,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="989" y="0"></use></g></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-67">
E=e^{(1)}+e^{(2)}+e^{(3)}+...+e^{(n)}
</script><p></p><p data-anchor-id="2fpi">上式的<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-68-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -913.1292620390899 1471.2431265281875 944.3293314070825" style="width: 3.387ex; height: 2.177ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-65"></use><g transform="translate(466,362)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="890" y="0"></use></g></g></svg></span><script type="math/tex" id="MathJax-Element-68">e^{(1)}</script>表示第一个样本的误差，<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-69-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -913.1292620390899 1471.2431265281875 944.3293314070825" style="width: 3.387ex; height: 2.177ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-65"></use><g transform="translate(466,362)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="890" y="0"></use></g></g></svg></span><script type="math/tex" id="MathJax-Element-69">e^{(2)}</script>表示第二个样本的误差......。</p><p data-anchor-id="chn1">我们还可以把上面的式子写成和式的形式。使用和式，不光书写起来简单，逼格也跟着暴涨，一举两得。所以一定要写成下面这样</p><div class="md-section-divider"></div><p data-anchor-id="9mhc"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-70-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -3929.4115809760347 44270.673387096766 7358.823161952069" style="width: 102.823ex; height: 17.056ex; vertical-align: -8.105ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(14314,0)"><g transform="translate(-15,0)"><use href="#MJMATHI-45" x="0" y="2966"></use></g><g transform="translate(1028,0)"><g transform="translate(0,2966)"><use href="#MJMAIN-3D"></use><g transform="translate(1056,0)"><use href="#MJMATHI-65"></use><g transform="translate(466,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="890" y="0"></use></g></g><use href="#MJMAIN-2B" x="2749" y="0"></use><g transform="translate(3750,0)"><use href="#MJMATHI-65"></use><g transform="translate(466,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="890" y="0"></use></g></g><use href="#MJMAIN-2B" x="5443" y="0"></use><g transform="translate(6444,0)"><use href="#MJMATHI-65"></use><g transform="translate(466,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-33" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="890" y="0"></use></g></g><use href="#MJMAIN-2B" x="7915" y="0"></use><use href="#MJMAIN-2E" x="8694" y="0"></use><use href="#MJMAIN-2E" x="9139" y="0"></use><use href="#MJMAIN-2E" x="9584" y="0"></use><use href="#MJMAIN-2B" x="10029" y="0"></use><g transform="translate(10808,0)"><use href="#MJMATHI-65"></use><g transform="translate(466,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="989" y="0"></use></g></g></g><g transform="translate(0,850)"><use href="#MJMAIN-3D"></use><g transform="translate(1056,0)"><use href="#MJSZ2-2211"></use><g transform="translate(147,-1090)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-69"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-3D" x="345" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1124" y="0"></use></g><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E" x="721" y="1627"></use></g><g transform="translate(2667,0)"><use href="#MJMATHI-65"></use><g transform="translate(466,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g></g><g transform="translate(0,-2213)"><use href="#MJMAIN-3D"></use><g transform="translate(1176,0)"><rect stroke="none" width="620" height="60" x="0" y="220"></rect><use href="#MJMAIN-31" x="60" y="676"></use><use href="#MJMAIN-32" x="60" y="-686"></use></g><g transform="translate(2083,0)"><use href="#MJSZ2-2211"></use><g transform="translate(147,-1090)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-69"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-3D" x="345" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1124" y="0"></use></g><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E" x="721" y="1627"></use></g><use href="#MJMAIN-28" x="3527" y="0"></use><g transform="translate(3917,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-2212" x="5534" y="0"></use><g transform="translate(6535,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><g transform="translate(7990,0)"><use href="#MJMAIN-29"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="550" y="583"></use></g><use href="#MJMAIN-28" x="12834" y="0"></use><g transform="translate(13223,0)"><text font-family="STIXGeneral,&#39;Arial Unicode MS&#39;,serif" font-style="" font-weight="" stroke="none" transform="scale(52.08314516129032) matrix(1 0 0 -1 0 0)">式</text></g><use href="#MJMAIN-32" x="14057" y="0"></use><use href="#MJMAIN-29" x="14557" y="0"></use></g></g></g><g transform="translate(42191,0)"><g transform="translate(0,2966)"><g id="mjx-eqn-3"><use href="#MJMAIN-28"></use><use href="#MJMAIN-33" x="389" y="0"></use><use href="#MJMAIN-29" x="890" y="0"></use></g></g><g transform="translate(0,850)"><g id="mjx-eqn-4"><use href="#MJMAIN-28"></use><use href="#MJMAIN-34" x="389" y="0"></use><use href="#MJMAIN-29" x="890" y="0"></use></g></g><g transform="translate(0,-2213)"><g id="mjx-eqn-5"><use href="#MJMAIN-28"></use><use href="#MJMAIN-35" x="389" y="0"></use><use href="#MJMAIN-29" x="890" y="0"></use></g></g></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-70">
\begin{align}
E&=e^{(1)}+e^{(2)}+e^{(3)}+...+e^{(n)}\\
&=\sum_{i=1}^{n}e^{(i)}\\
&=\frac{1}{2}\sum_{i=1}^{n}(y^{(i)}-\bar{y}^{(i)})^2\qquad\qquad(式2)
\end{align}
</script><p></p><p data-anchor-id="r0e7">其中</p><div class="md-section-divider"></div><p data-anchor-id="g1g8"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-71-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -1614.1292620390898 44270.673387096766 2728.2585240781796" style="width: 102.823ex; height: 6.29ex; vertical-align: -2.661ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(19524,0)"><g transform="translate(-15,0)"><g transform="translate(0,651)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g></g><g transform="translate(1719,0)"><g transform="translate(0,651)"><use href="#MJMAIN-3D"></use><use href="#MJMATHI-68" x="1056" y="0"></use><use href="#MJMAIN-28" x="1632" y="0"></use><g transform="translate(2022,0)"><use href="#MJMAIN-78"></use><g transform="translate(528,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-29" x="3445" y="0"></use></g><g transform="translate(0,-844)"><use href="#MJMAIN-3D"></use><g transform="translate(1056,0)"><use href="#MJMAIN-77"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-54" x="1021" y="583"></use></g><g transform="translate(2376,0)"><use href="#MJMAIN-78"></use><g transform="translate(528,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="668" y="0"></use></g></g></g></g></g><g transform="translate(42191,0)"><g transform="translate(0,651)"><g id="mjx-eqn-6"><use href="#MJMAIN-28"></use><use href="#MJMAIN-36" x="389" y="0"></use><use href="#MJMAIN-29" x="890" y="0"></use></g></g><g transform="translate(0,-844)"><g id="mjx-eqn-7"><use href="#MJMAIN-28"></use><use href="#MJMAIN-37" x="389" y="0"></use><use href="#MJMAIN-29" x="890" y="0"></use></g></g></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-71">
\begin{align}
\bar{y}^{(i)}&=h(\mathrm{x}^{(i)})\\
&=\mathrm{w}^T\mathrm{x^{(i)}}
\end{align}
</script><p></p><p data-anchor-id="1rfq">(式2)中，<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-72-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -913.1292620390899 1467.6415754442728 944.3293314070825" style="width: 3.387ex; height: 2.177ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><g transform="translate(572,362)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g></svg></span><script type="math/tex" id="MathJax-Element-72">x^{(i)}</script>表示第<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-73-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -681.2000693679926 345.5 712.4001387359851" style="width: 0.847ex; height: 1.694ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-69"></use></g></svg></span><script type="math/tex" id="MathJax-Element-73">i</script>个训练样本的<strong>特征</strong>，<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-74-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -913.1292620390899 1394.7915754442727 1138.3293314070825" style="width: 3.266ex; height: 2.661ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use><g transform="translate(499,362)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g></svg></span><script type="math/tex" id="MathJax-Element-74">y^{(i)}</script>表示第<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-75-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -681.2000693679926 345.5 712.4001387359851" style="width: 0.847ex; height: 1.694ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-69"></use></g></svg></span><script type="math/tex" id="MathJax-Element-75">i</script>个样本的<strong>标记</strong>，我们也可以用<strong>元组</strong><span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-76-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -913.1292620390899 4086.599817555212 1183.3293314070825" style="width: 9.435ex; height: 2.782ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-28"></use><g transform="translate(389,0)"><use href="#MJMATHI-78"></use><g transform="translate(572,362)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-2C" x="1857" y="0"></use><g transform="translate(2302,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,362)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-29" x="3697" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-76">(x^{(i)},y^{(i)})</script>表示第<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-77-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -681.2000693679926 345.5 712.4001387359851" style="width: 0.847ex; height: 1.694ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-69"></use></g></svg></span><script type="math/tex" id="MathJax-Element-77">i</script><strong>训练样本</strong>。<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-78-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -913.1292620390899 1455.8165754442725 1138.3293314070825" style="width: 3.387ex; height: 2.661ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,362)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g></svg></span><script type="math/tex" id="MathJax-Element-78">\bar{y}^{(i)}</script>则是模型对第<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-79-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -681.2000693679926 345.5 712.4001387359851" style="width: 0.847ex; height: 1.694ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-69"></use></g></svg></span><script type="math/tex" id="MathJax-Element-79">i</script>个样本的<strong>预测值</strong>。</p><p data-anchor-id="28u8">我们当然希望对于一个训练数据集来说，误差最小越好，也就是(式2)的值越小越好。对于特定的训练数据集来说，<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-80-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -913.1292620390899 4086.599817555212 1183.3293314070825" style="width: 9.435ex; height: 2.782ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-28"></use><g transform="translate(389,0)"><use href="#MJMATHI-78"></use><g transform="translate(572,362)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-2C" x="1857" y="0"></use><g transform="translate(2302,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,362)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-29" x="3697" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-80">(x^{(i)},y^{(i)})</script>的值都是已知的，所以(式2)其实是参数<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-81-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 722.5 482.40013873598514" style="width: 1.694ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-77"></use></g></svg></span><script type="math/tex" id="MathJax-Element-81">\mathrm{w}</script>的函数。</p><div class="md-section-divider"></div><p data-anchor-id="zc2p"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-82-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -3181.9469846404854 44270.673387096766 5863.893969280971" style="width: 102.823ex; height: 13.669ex; vertical-align: -6.29ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(16002,0)"><g transform="translate(-15,0)"><g transform="translate(0,1597)"><use href="#MJMATHI-45"></use><use href="#MJMAIN-28" x="764" y="0"></use><use href="#MJMAIN-77" x="1154" y="0"></use><use href="#MJMAIN-29" x="1876" y="0"></use></g></g><g transform="translate(2529,0)"><g transform="translate(0,1597)"><use href="#MJMAIN-3D"></use><g transform="translate(1176,0)"><rect stroke="none" width="620" height="60" x="0" y="220"></rect><use href="#MJMAIN-31" x="60" y="676"></use><use href="#MJMAIN-32" x="60" y="-686"></use></g><g transform="translate(2083,0)"><use href="#MJSZ2-2211"></use><g transform="translate(147,-1090)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-69"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-3D" x="345" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1124" y="0"></use></g><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E" x="721" y="1627"></use></g><use href="#MJMAIN-28" x="3527" y="0"></use><g transform="translate(3917,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-2212" x="5534" y="0"></use><g transform="translate(6535,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><g transform="translate(7990,0)"><use href="#MJMAIN-29"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="550" y="583"></use></g></g><g transform="translate(0,-1465)"><use href="#MJMAIN-3D"></use><g transform="translate(1176,0)"><rect stroke="none" width="620" height="60" x="0" y="220"></rect><use href="#MJMAIN-31" x="60" y="676"></use><use href="#MJMAIN-32" x="60" y="-686"></use></g><g transform="translate(2083,0)"><use href="#MJSZ2-2211"></use><g transform="translate(147,-1090)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-69"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-3D" x="345" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1124" y="0"></use></g><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E" x="721" y="1627"></use></g><use href="#MJMAIN-28" x="3527" y="0"></use><g transform="translate(3917,0)"><use href="#MJMAIN-79"></use><g transform="translate(528,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="668" y="0"></use></g><use href="#MJMAIN-2212" x="1598" y="0"></use><g transform="translate(2599,0)"><use href="#MJMAIN-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-54" x="1021" y="583"></use></g><g transform="translate(3932,0)"><use href="#MJMAIN-78"></use><g transform="translate(528,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="668" y="0"></use></g></g></g><g transform="translate(9226,0)"><use href="#MJMAIN-29"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="550" y="583"></use></g></g></g></g><g transform="translate(42191,0)"><g transform="translate(0,1597)"><g id="mjx-eqn-8"><use href="#MJMAIN-28"></use><use href="#MJMAIN-38" x="389" y="0"></use><use href="#MJMAIN-29" x="890" y="0"></use></g></g><g transform="translate(0,-1465)"><g id="mjx-eqn-9"><use href="#MJMAIN-28"></use><use href="#MJMAIN-39" x="389" y="0"></use><use href="#MJMAIN-29" x="890" y="0"></use></g></g></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-82">
\begin{align}
E(\mathrm{w})&=\frac{1}{2}\sum_{i=1}^{n}(y^{(i)}-\bar{y}^{(i)})^2\\
&=\frac{1}{2}\sum_{i=1}^{n}(\mathrm{y^{(i)}-\mathrm{w}^Tx^{(i)}})^2
\end{align}
</script><p></p><p data-anchor-id="htcu">由此可见，模型的训练，实际上就是求取到合适的<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-83-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 722.5 482.40013873598514" style="width: 1.694ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-77"></use></g></svg></span><script type="math/tex" id="MathJax-Element-83">\mathrm{w}</script>，使(式2)取得最小值。这在数学上称作<strong>优化问题</strong>，而<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-84-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 2266 1040.4001387359851" style="width: 5.323ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-45"></use><use href="#MJMAIN-28" x="764" y="0"></use><use href="#MJMAIN-77" x="1154" y="0"></use><use href="#MJMAIN-29" x="1876" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-84">E(\mathrm{w})</script>就是我们优化的目标，称之为<strong>目标函数</strong>。</p><div class="md-section-divider"></div><h3 data-anchor-id="d23c" id="梯度下降优化算法">梯度下降优化算法</h3><p data-anchor-id="q6ke">大学时我们学过怎样求函数的极值。函数<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-85-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 3733.5555555555557 1040.4001387359851" style="width: 8.71ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use><use href="#MJMAIN-3D" x="775" y="0"></use><use href="#MJMATHI-66" x="1831" y="0"></use><use href="#MJMAIN-28" x="2382" y="0"></use><use href="#MJMATHI-78" x="2771" y="0"></use><use href="#MJMAIN-29" x="3344" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-85">y=f(x)</script>的极值点，就是它的导数<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-86-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -778.7789736136457 4049.4134737724494 1048.9790429816383" style="width: 9.435ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-66"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-2032" x="804" y="513"></use><use href="#MJMAIN-28" x="863" y="0"></use><use href="#MJMATHI-78" x="1252" y="0"></use><use href="#MJMAIN-29" x="1825" y="0"></use><use href="#MJMAIN-3D" x="2492" y="0"></use><use href="#MJMAIN-30" x="3548" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-86">f'(x)=0</script>的那个点。因此我们可以通过解方程<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-87-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -778.7789736136457 4049.4134737724494 1048.9790429816383" style="width: 9.435ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-66"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-2032" x="804" y="513"></use><use href="#MJMAIN-28" x="863" y="0"></use><use href="#MJMATHI-78" x="1252" y="0"></use><use href="#MJMAIN-29" x="1825" y="0"></use><use href="#MJMAIN-3D" x="2492" y="0"></use><use href="#MJMAIN-30" x="3548" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-87">f'(x)=0</script>，求得函数的极值点<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-88-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 3194.9805546344005 1040.4001387359851" style="width: 7.379ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-28"></use><g transform="translate(389,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-30" x="809" y="-213"></use></g><use href="#MJMAIN-2C" x="1415" y="0"></use><g transform="translate(1861,0)"><use href="#MJMATHI-79"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-30" x="693" y="-213"></use></g><use href="#MJMAIN-29" x="2805" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-88">(x_0,y_0)</script>。</p><p data-anchor-id="zmg2">不过对于计算机来说，它可不会解方程。但是它可以凭借强大的计算能力，一步一步的去把函数的极值点『试』出来。如下图所示：</p><p data-anchor-id="aiyd"><img src="./零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器_files/2256672-46acc2c2d52fc366.png" alt="" title=""></p><p data-anchor-id="haeg">首先，我们随便选择一个点开始，比如上图的<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-89-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 1026.406943983867 647.6635947032757" style="width: 2.419ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-30" x="809" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-89">x_0</script>点。接下来，每次迭代修改<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-90-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 572.5 493.40013873598514" style="width: 1.331ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use></g></svg></span><script type="math/tex" id="MathJax-Element-90">x</script>的为<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-91-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 5583.554165284935 677.4001387359851" style="width: 12.944ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="809" y="-213"></use><use href="#MJMAIN-2C" x="1026" y="0"></use><g transform="translate(1471,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="809" y="-213"></use></g><use href="#MJMAIN-2C" x="2497" y="0"></use><g transform="translate(2943,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-33" x="809" y="-213"></use></g><use href="#MJMAIN-2C" x="3969" y="0"></use><use href="#MJMAIN-2E" x="4414" y="0"></use><use href="#MJMAIN-2E" x="4859" y="0"></use><use href="#MJMAIN-2E" x="5305" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-91">x_1,x_2,x_3,...</script>，经过数次迭代后最终达到函数最小值点。</p><p data-anchor-id="eiz8">你可能要问了，为啥每次修改<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-92-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 572.5 493.40013873598514" style="width: 1.331ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use></g></svg></span><script type="math/tex" id="MathJax-Element-92">x</script>的值，都能往函数最小值那个方向前进呢？这里的奥秘在于，我们每次都是向函数<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-93-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 3733.5555555555557 1040.4001387359851" style="width: 8.71ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use><use href="#MJMAIN-3D" x="775" y="0"></use><use href="#MJMATHI-66" x="1831" y="0"></use><use href="#MJMAIN-28" x="2382" y="0"></use><use href="#MJMATHI-78" x="2771" y="0"></use><use href="#MJMAIN-29" x="3344" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-93">y=f(x)</script>的<strong>梯度</strong>的<strong>相反方向</strong>来修改<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-94-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 572.5 493.40013873598514" style="width: 1.331ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use></g></svg></span><script type="math/tex" id="MathJax-Element-94">x</script>。什么是<strong>梯度</strong>呢？翻开大学高数课的课本，我们会发现<strong>梯度</strong>是一个向量，它指向<strong>函数值上升最快</strong>的方向。显然，梯度的反方向当然就是函数值下降最快的方向了。我们每次沿着梯度相反方向去修改<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-95-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 572.5 493.40013873598514" style="width: 1.331ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use></g></svg></span><script type="math/tex" id="MathJax-Element-95">x</script>的值，当然就能走到函数的最小值附近。之所以是最小值附近而不是最小值那个点，是因为我们每次移动的步长不会那么恰到好处，有可能最后一次迭代走远了越过了最小值那个点。步长的选择是门手艺，如果选择小了，那么就会迭代很多轮才能走到最小值附近；如果选择大了，那可能就会越过最小值很远，收敛不到一个好的点上。</p><p data-anchor-id="4tvz">按照上面的讨论，我们就可以写出梯度下降算法的公式</p><div class="md-section-divider"></div><p data-anchor-id="umxg"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-96-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 9238.66706064762 1040.4001387359851" style="width: 21.411ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-78"></use><g transform="translate(528,-150)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-65" x="600" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-77" x="1067" y="0"></use></g><use href="#MJMAIN-3D" x="2167" y="0"></use><g transform="translate(3223,0)"><use href="#MJMAIN-78"></use><g transform="translate(528,-150)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-6F"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-6C" x="485" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-64" x="784" y="0"></use></g></g><use href="#MJMAIN-2212" x="4998" y="0"></use><use href="#MJMATHI-3B7" x="5999" y="0"></use><use href="#MJMAIN-2207" x="6503" y="0"></use><g transform="translate(7336,0)"><use href="#MJMATHI-66"></use><use href="#MJMAIN-28" x="550" y="0"></use><use href="#MJMATHI-78" x="940" y="0"></use><use href="#MJMAIN-29" x="1512" y="0"></use></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-96">
\mathrm{x}_{new}=\mathrm{x}_{old}-\eta\nabla{f(x)}
</script><p></p><p data-anchor-id="jkf7">其中，<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-97-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -703.2000693679926 833.5 756.4001387359851" style="width: 1.935ex; height: 1.815ex; vertical-align: -0.242ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-2207"></use></g></svg></span><script type="math/tex" id="MathJax-Element-97">\nabla</script>是<strong>梯度算子</strong>，<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-98-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 2735.5 1040.4001387359851" style="width: 6.411ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-2207"></use><g transform="translate(833,0)"><use href="#MJMATHI-66"></use><use href="#MJMAIN-28" x="550" y="0"></use><use href="#MJMATHI-78" x="940" y="0"></use><use href="#MJMAIN-29" x="1512" y="0"></use></g></g></svg></span><script type="math/tex" id="MathJax-Element-98">\nabla{f(x)}</script>就是指<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-99-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 1902 1040.4001387359851" style="width: 4.476ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-66"></use><use href="#MJMAIN-28" x="550" y="0"></use><use href="#MJMATHI-78" x="940" y="0"></use><use href="#MJMAIN-29" x="1512" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-99">f(x)</script>的梯度。<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-100-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 503.5 699.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-3B7"></use></g></svg></span><script type="math/tex" id="MathJax-Element-100">\eta</script>是步长，也称作<strong>学习速率</strong>。</p><p data-anchor-id="5ozh">对于上一节列出的目标函数(式2)</p><div class="md-section-divider"></div><p data-anchor-id="p6vv"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-101-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -1584.1554802148196 11280.104452860083 2801.147054008478" style="width: 26.25ex; height: 6.532ex; vertical-align: -2.903ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-45"></use><use href="#MJMAIN-28" x="764" y="0"></use><use href="#MJMAIN-77" x="1154" y="0"></use><use href="#MJMAIN-29" x="1876" y="0"></use><use href="#MJMAIN-3D" x="2543" y="0"></use><g transform="translate(3720,0)"><rect stroke="none" width="620" height="60" x="0" y="220"></rect><use href="#MJMAIN-31" x="60" y="676"></use><use href="#MJMAIN-32" x="60" y="-686"></use></g><g transform="translate(4627,0)"><use href="#MJSZ2-2211"></use><g transform="translate(147,-1090)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-69"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-3D" x="345" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1124" y="0"></use></g><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E" x="721" y="1627"></use></g><use href="#MJMAIN-28" x="6071" y="0"></use><g transform="translate(6461,0)"><use href="#MJMAIN-79"></use><g transform="translate(528,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="668" y="0"></use></g><use href="#MJMAIN-2212" x="1598" y="0"></use><g transform="translate(2599,0)"><use href="#MJMAIN-79"></use><use href="#MJMAIN-AF" x="14" y="-33"></use><g transform="translate(528,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="668" y="0"></use></g></g></g><g transform="translate(10436,0)"><use href="#MJMAIN-29"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="550" y="583"></use></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-101">
E(\mathrm{w})=\frac{1}{2}\sum_{i=1}^{n}(\mathrm{y^{(i)}-\bar{y}^{(i)}})^2
</script><p></p><p data-anchor-id="cj9h">梯度下降算法可以写成</p><div class="md-section-divider"></div><p data-anchor-id="ntxr"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-102-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 9990.66706064762 1040.4001387359851" style="width: 23.226ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-77"></use><g transform="translate(722,-150)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-65" x="600" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-77" x="1067" y="0"></use></g><use href="#MJMAIN-3D" x="2361" y="0"></use><g transform="translate(3417,0)"><use href="#MJMAIN-77"></use><g transform="translate(722,-150)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-6F"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-6C" x="485" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-64" x="784" y="0"></use></g></g><use href="#MJMAIN-2212" x="5386" y="0"></use><use href="#MJMATHI-3B7" x="6387" y="0"></use><use href="#MJMAIN-2207" x="6891" y="0"></use><g transform="translate(7724,0)"><use href="#MJMATHI-45"></use><use href="#MJMAIN-28" x="764" y="0"></use><use href="#MJMAIN-77" x="1154" y="0"></use><use href="#MJMAIN-29" x="1876" y="0"></use></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-102">
\mathrm{w}_{new}=\mathrm{w}_{old}-\eta\nabla{E(\mathrm{w})}
</script><p></p><p data-anchor-id="eglt">聪明的你应该能想到，如果要求目标函数的<strong>最大值</strong>，那么我们就应该用<strong>梯度上升</strong>算法，它的参数修改规则是</p><div class="md-section-divider"></div><p data-anchor-id="gsyf"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-103-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 9990.66706064762 1040.4001387359851" style="width: 23.226ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-77"></use><g transform="translate(722,-150)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-65" x="600" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-77" x="1067" y="0"></use></g><use href="#MJMAIN-3D" x="2361" y="0"></use><g transform="translate(3417,0)"><use href="#MJMAIN-77"></use><g transform="translate(722,-150)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-6F"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-6C" x="485" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-64" x="784" y="0"></use></g></g><use href="#MJMAIN-2B" x="5386" y="0"></use><use href="#MJMATHI-3B7" x="6387" y="0"></use><use href="#MJMAIN-2207" x="6891" y="0"></use><g transform="translate(7724,0)"><use href="#MJMATHI-45"></use><use href="#MJMAIN-28" x="764" y="0"></use><use href="#MJMAIN-77" x="1154" y="0"></use><use href="#MJMAIN-29" x="1876" y="0"></use></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-103">
\mathrm{w}_{new}=\mathrm{w}_{old}+\eta\nabla{E(\mathrm{w})}
</script><p></p><p data-anchor-id="yrzt">下面，请先做几次深呼吸，让你的大脑补充足够的新鲜的氧气，我们要来求取<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-104-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 3099.5 1040.4001387359851" style="width: 7.258ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-2207"></use><use href="#MJMATHI-45" x="833" y="0"></use><use href="#MJMAIN-28" x="1598" y="0"></use><use href="#MJMAIN-77" x="1987" y="0"></use><use href="#MJMAIN-29" x="2710" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-104">\nabla{E}(\mathrm{w})</script>，然后带入上式，就能得到线性单元的参数修改规则。</p><p data-anchor-id="8dcf">关于<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-105-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 3099.5 1040.4001387359851" style="width: 7.258ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-2207"></use><g transform="translate(833,0)"><use href="#MJMATHI-45"></use><use href="#MJMAIN-28" x="764" y="0"></use><use href="#MJMAIN-77" x="1154" y="0"></use><use href="#MJMAIN-29" x="1876" y="0"></use></g></g></svg></span><script type="math/tex" id="MathJax-Element-105">\nabla{E(\mathrm{w})}</script>的推导过程，我单独把它们放到一节中。您既可以选择慢慢看，也可以选择无视。在这里，您只需要知道，经过一大串推导，目标函数<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-106-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 2260 1040.4001387359851" style="width: 5.202ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-45"></use><use href="#MJMAIN-28" x="764" y="0"></use><use href="#MJMATHI-77" x="1154" y="0"></use><use href="#MJMAIN-29" x="1870" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-106">E(w)</script>的梯度是</p><div class="md-section-divider"></div><p data-anchor-id="j0tz"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-107-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -1584.1554802148196 13099.416392999485 2801.147054008478" style="width: 30.484ex; height: 6.532ex; vertical-align: -2.903ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-2207"></use><g transform="translate(833,0)"><use href="#MJMATHI-45"></use><use href="#MJMAIN-28" x="764" y="0"></use><use href="#MJMAIN-77" x="1154" y="0"></use><use href="#MJMAIN-29" x="1876" y="0"></use></g><use href="#MJMAIN-3D" x="3377" y="0"></use><use href="#MJMAIN-2212" x="4433" y="0"></use><g transform="translate(5378,0)"><use href="#MJSZ2-2211"></use><g transform="translate(147,-1090)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-69"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-3D" x="345" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1124" y="0"></use></g><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E" x="721" y="1627"></use></g><use href="#MJMAIN-28" x="6823" y="0"></use><g transform="translate(7212,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-2212" x="8829" y="0"></use><g transform="translate(9830,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-29" x="11286" y="0"></use><g transform="translate(11675,0)"><use href="#MJMAIN-78"></use><g transform="translate(528,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-107">
\nabla{E(\mathrm{w})}=-\sum_{i=1}^{n}(y^{(i)}-\bar{y}^{(i)})\mathrm{x}^{(i)}
</script><p></p><p data-anchor-id="ll1q">因此，线性单元的参数修改规则最后是这个样子</p><div class="md-section-divider"></div><p data-anchor-id="8f5s"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-108-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -1584.1554802148196 20891.358220672195 2801.147054008478" style="width: 48.508ex; height: 6.532ex; vertical-align: -2.903ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-77"></use><g transform="translate(722,-150)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-65" x="600" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-77" x="1067" y="0"></use></g><use href="#MJMAIN-3D" x="2361" y="0"></use><g transform="translate(3417,0)"><use href="#MJMAIN-77"></use><g transform="translate(722,-150)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-6F"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-6C" x="485" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-64" x="784" y="0"></use></g></g><use href="#MJMAIN-2B" x="5386" y="0"></use><use href="#MJMATHI-3B7" x="6387" y="0"></use><g transform="translate(7057,0)"><use href="#MJSZ2-2211"></use><g transform="translate(147,-1090)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-69"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-3D" x="345" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1124" y="0"></use></g><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E" x="721" y="1627"></use></g><use href="#MJMAIN-28" x="8502" y="0"></use><g transform="translate(8891,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-2212" x="10508" y="0"></use><g transform="translate(11509,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-29" x="12965" y="0"></use><g transform="translate(13354,0)"><use href="#MJMAIN-78"></use><g transform="translate(528,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-28" x="18778" y="0"></use><g transform="translate(19168,0)"><text font-family="STIXGeneral,&#39;Arial Unicode MS&#39;,serif" font-style="" font-weight="" stroke="none" transform="scale(52.08314516129032) matrix(1 0 0 -1 0 0)">式</text></g><use href="#MJMAIN-33" x="20001" y="0"></use><use href="#MJMAIN-29" x="20501" y="0"></use></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-108">
\mathrm{w}_{new}=\mathrm{w}_{old}+\eta\sum_{i=1}^{n}(y^{(i)}-\bar{y}^{(i)})\mathrm{x}^{(i)}\qquad\qquad(式3)
</script><p></p><p data-anchor-id="04h2">有了上面这个式子，我们就可以根据它来写出训练线性单元的代码了。</p><p data-anchor-id="ueud">需要说明的是，如果每个样本有M个特征，则上式中的<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-109-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 1696.1666666666665 666.4001387359851" style="width: 3.992ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-78"></use><use href="#MJMAIN-2C" x="528" y="0"></use><use href="#MJMAIN-77" x="973" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-109">\mathrm{x},\mathrm{w}</script>都是M+1维<strong>向量</strong>(因为我们加上了一个恒为1的虚拟特征<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-110-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 1026.406943983867 647.6635947032757" style="width: 2.419ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-30" x="809" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-110">x_0</script>，参考前面的内容)，而<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-111-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-111">y</script>是<strong>标量</strong>。用高逼格的数学符号表示，就是</p><div class="md-section-divider"></div><p data-anchor-id="znr7"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true"><span class="MathJax_SVG" id="MathJax-Element-112-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -963.1292620390899 44270.673387096766 2699.415554458509" style="width: 102.823ex; height: 6.29ex; vertical-align: -4.113ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(19112,0)"><use href="#MJMAIN-78"></use><use href="#MJMAIN-2C" x="528" y="0"></use><use href="#MJMAIN-77" x="973" y="0"></use><use href="#MJMAIN-2208" x="1973" y="0"></use><g transform="translate(2919,0)"><use href="#MJFRAK-52"></use><g transform="translate(828,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-4D" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-2B" x="1441" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="2219" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="2720" y="0"></use></g></g></g><g transform="translate(20772,-1512)"><use href="#MJMATHI-79"></use><use href="#MJMAIN-2208" x="775" y="0"></use><g transform="translate(1442,0)"><use href="#MJFRAK-52"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1171" y="583"></use></g></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-112">
\mathrm{x},\mathrm{w}\in\Re^{(M+1)}\\
y\in\Re^1
</script><p></p><p data-anchor-id="admf">为了让您看明白说的是啥，我吐血写下下面这个解释(写这种公式可累可累了)。因为<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-113-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 1696.1666666666667 666.4001387359851" style="width: 3.992ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-77"></use><use href="#MJMAIN-2C" x="722" y="0"></use><use href="#MJMAIN-78" x="1167" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-113">\mathrm{w},\mathrm{x}</script>是M+1维<strong>列向量</strong>，所以(式3)可以写成</p><div class="md-section-divider"></div><p data-anchor-id="2olm"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-114-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -3703.5984264076806 21216.71435655833 6907.196852815361" style="width: 49.234ex; height: 16.089ex; vertical-align: -7.5ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(0,3150)"><use href="#MJSZ4-23A1" x="0" y="-1155"></use><g transform="translate(0,-4045.1953642384105) scale(1,3.8046357615894038)"><use href="#MJSZ4-23A2"></use></g><use href="#MJSZ4-23A3" x="0" y="-5155"></use></g><g transform="translate(834,0)"><g transform="translate(-15,0)"><g transform="translate(133,2350)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-30" x="1013" y="-213"></use></g><g transform="translate(133,1150)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1013" y="-213"></use></g><g transform="translate(133,-50)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="1013" y="-213"></use></g><g transform="translate(134,-1250)"><use href="#MJMAIN-2E"></use><use href="#MJMAIN-2E" x="445" y="0"></use><use href="#MJMAIN-2E" x="890" y="0"></use></g><g transform="translate(0,-2450)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-6D" x="1013" y="-213"></use></g></g></g><g transform="translate(2424,3150)"><use href="#MJSZ4-23A4" x="0" y="-1155"></use><g transform="translate(0,-4045.1953642384105) scale(1,3.8046357615894038)"><use href="#MJSZ4-23A5"></use></g><use href="#MJSZ4-23A6" x="0" y="-5155"></use></g><g transform="translate(3092,-2686)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-65" x="600" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-77" x="1067" y="0"></use></g><use href="#MJMAIN-3D" x="4731" y="0"></use><g transform="translate(5787,0)"><g transform="translate(0,3150)"><use href="#MJSZ4-23A1" x="0" y="-1155"></use><g transform="translate(0,-4045.1953642384105) scale(1,3.8046357615894038)"><use href="#MJSZ4-23A2"></use></g><use href="#MJSZ4-23A3" x="0" y="-5155"></use></g><g transform="translate(834,0)"><g transform="translate(-15,0)"><g transform="translate(133,2350)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-30" x="1013" y="-213"></use></g><g transform="translate(133,1150)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1013" y="-213"></use></g><g transform="translate(133,-50)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="1013" y="-213"></use></g><g transform="translate(134,-1250)"><use href="#MJMAIN-2E"></use><use href="#MJMAIN-2E" x="445" y="0"></use><use href="#MJMAIN-2E" x="890" y="0"></use></g><g transform="translate(0,-2450)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-6D" x="1013" y="-213"></use></g></g></g><g transform="translate(2424,3150)"><use href="#MJSZ4-23A4" x="0" y="-1155"></use><g transform="translate(0,-4045.1953642384105) scale(1,3.8046357615894038)"><use href="#MJSZ4-23A5"></use></g><use href="#MJSZ4-23A6" x="0" y="-5155"></use></g><g transform="translate(3092,-2686)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-6F"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-6C" x="485" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-64" x="784" y="0"></use></g></g><use href="#MJMAIN-2B" x="10126" y="0"></use><use href="#MJMATHI-3B7" x="11127" y="0"></use><g transform="translate(11797,0)"><use href="#MJSZ2-2211"></use><g transform="translate(147,-1090)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-69"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-3D" x="345" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1124" y="0"></use></g><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E" x="721" y="1627"></use></g><use href="#MJMAIN-28" x="13241" y="0"></use><g transform="translate(13631,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-2212" x="15248" y="0"></use><g transform="translate(16249,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-29" x="17704" y="0"></use><g transform="translate(18094,0)"><g transform="translate(0,3684)"><use href="#MJSZ4-23A1" x="0" y="-1155"></use><g transform="translate(0,-5112.222547334211) scale(1,5.57416674516453)"><use href="#MJSZ4-23A2"></use></g><use href="#MJSZ4-23A3" x="0" y="-6224"></use></g><g transform="translate(834,0)"><g transform="translate(-15,0)"><use href="#MJMAIN-31" x="483" y="2884"></use><g transform="translate(0,1430)"><use href="#MJMATHI-78"></use><g transform="translate(572,521)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="809" y="-435"></use></g><g transform="translate(0,-331)"><use href="#MJMATHI-78"></use><g transform="translate(572,521)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="809" y="-435"></use></g><g transform="translate(149,-1531)"><use href="#MJMAIN-2E"></use><use href="#MJMAIN-2E" x="445" y="0"></use><use href="#MJMAIN-2E" x="890" y="0"></use></g><g transform="translate(0,-2985)"><use href="#MJMATHI-78"></use><g transform="translate(572,521)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g><use transform="scale(0.7071067811865476)" href="#MJMATHI-6D" x="809" y="-212"></use></g></g></g><g transform="translate(2454,3684)"><use href="#MJSZ4-23A4" x="0" y="-1155"></use><g transform="translate(0,-5112.222547334211) scale(1,5.57416674516453)"><use href="#MJSZ4-23A5"></use></g><use href="#MJSZ4-23A6" x="0" y="-6224"></use></g></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-114">
\begin{bmatrix}
w_0 \\
w_1 \\
w_2 \\
... \\
w_m \\
\end{bmatrix}_{new}=
\begin{bmatrix}
w_0 \\
w_1 \\
w_2 \\
... \\
w_m \\
\end{bmatrix}_{old}+\eta\sum_{i=1}^{n}(y^{(i)}-\bar{y}^{(i)})
\begin{bmatrix}
1 \\
x_1^{(i)} \\
x_2^{(i)} \\
... \\
x_m^{(i)} \\
\end{bmatrix}
</script><p></p><p data-anchor-id="5k4c">如果您还是没看明白，建议您也吐血再看一下大学时学过的《线性代数》吧。</p><div class="md-section-divider"></div><h4 data-anchor-id="ds6s" id="nablaemathrmwnablaemathrmw的推导"><span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-115-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -772.6000780389917 3099.5 1045.2001560779834" style="width: 7.204ex; height: 2.473ex; vertical-align: -0.753ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-2207"></use><use href="#MJMATHI-45" x="833" y="0"></use><use href="#MJMAIN-28" x="1598" y="0"></use><use href="#MJMAIN-77" x="1987" y="0"></use><use href="#MJMAIN-29" x="2710" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-115">\nabla{E}(\mathrm{w})</script>的推导</h4><p data-anchor-id="rpyy">这一节你尽可以跳过它，并不太会影响到全文的理解。当然如果你非要弄明白每个细节，那恭喜你骚年，机器学习的未来一定是属于你的。</p><p data-anchor-id="sbmh">首先，我们先做一个简单的前戏。我们知道函数的梯度的定义就是它相对于各个变量的<strong>偏导数</strong>，所以我们写下下面的式子</p><div class="md-section-divider"></div><p data-anchor-id="vkow"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-116-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -2851.431458455852 44270.673387096766 5202.862916911704" style="width: 102.823ex; height: 12.097ex; vertical-align: -5.565ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(15295,0)"><g transform="translate(-15,0)"><g transform="translate(0,1439)"><use href="#MJMAIN-2207"></use><g transform="translate(833,0)"><use href="#MJMATHI-45"></use><use href="#MJMAIN-28" x="764" y="0"></use><use href="#MJMAIN-77" x="1154" y="0"></use><use href="#MJMAIN-29" x="1876" y="0"></use></g></g></g><g transform="translate(3363,0)"><g transform="translate(0,1439)"><use href="#MJMAIN-3D"></use><g transform="translate(1176,0)"><rect stroke="none" width="1410" height="60" x="0" y="220"></rect><use href="#MJMAIN-2202" x="421" y="676"></use><g transform="translate(60,-687)"><use href="#MJMAIN-2202"></use><use href="#MJMAIN-77" x="567" y="0"></use></g></g><use href="#MJMATHI-45" x="2872" y="0"></use><use href="#MJMAIN-28" x="3637" y="0"></use><use href="#MJMAIN-77" x="4026" y="0"></use><use href="#MJMAIN-29" x="4749" y="0"></use></g><g transform="translate(0,-1135)"><use href="#MJMAIN-3D"></use><g transform="translate(1176,0)"><rect stroke="none" width="1410" height="60" x="0" y="220"></rect><use href="#MJMAIN-2202" x="421" y="676"></use><g transform="translate(60,-687)"><use href="#MJMAIN-2202"></use><use href="#MJMAIN-77" x="567" y="0"></use></g></g><g transform="translate(2992,0)"><rect stroke="none" width="620" height="60" x="0" y="220"></rect><use href="#MJMAIN-31" x="60" y="676"></use><use href="#MJMAIN-32" x="60" y="-686"></use></g><g transform="translate(3900,0)"><use href="#MJSZ2-2211"></use><g transform="translate(147,-1090)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-69"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-3D" x="345" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1124" y="0"></use></g><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E" x="721" y="1627"></use></g><use href="#MJMAIN-28" x="5344" y="0"></use><g transform="translate(5734,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-2212" x="7351" y="0"></use><g transform="translate(8351,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><g transform="translate(9807,0)"><use href="#MJMAIN-29"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="550" y="583"></use></g></g></g></g><g transform="translate(41690,0)"><g transform="translate(0,1439)"><g id="mjx-eqn-10"><use href="#MJMAIN-28"></use><use href="#MJMAIN-31" x="389" y="0"></use><use href="#MJMAIN-30" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g><g transform="translate(0,-1135)"><g id="mjx-eqn-11"><use href="#MJMAIN-28"></use><use href="#MJMAIN-31" x="389" y="0"></use><use href="#MJMAIN-31" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-116">
\begin{align}
\nabla{E(\mathrm{w})}&=\frac{\partial}{\partial\mathrm{w}}E(\mathrm{w})\\
&=\frac{\partial}{\partial\mathrm{w}}\frac{1}{2}\sum_{i=1}^{n}(y^{(i)}-\bar{y}^{(i)})^2\\
\end{align}
</script><p></p><p data-anchor-id="ilgc">可接下来怎么办呢？我们知道和的导数等于导数的和，所以我们可以先把求和符号<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-117-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 1056.5 1040.4001387359851" style="width: 2.419ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJSZ1-2211"></use></g></svg></span><script type="math/tex" id="MathJax-Element-117">\sum</script>里面的导数求出来，然后再把它们加在一起就行了，也就是</p><div class="md-section-divider"></div><p data-anchor-id="ra7a"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-118-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -3181.9469846404854 44270.673387096766 5863.893969280971" style="width: 102.823ex; height: 13.669ex; vertical-align: -6.29ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(16900,0)"><g transform="translate(-15,0)"><use href="#MJMAIN-3D" x="0" y="-1465"></use></g><g transform="translate(1042,0)"><g transform="translate(0,1597)"><g transform="translate(120,0)"><rect stroke="none" width="1410" height="60" x="0" y="220"></rect><use href="#MJMAIN-2202" x="421" y="676"></use><g transform="translate(60,-687)"><use href="#MJMAIN-2202"></use><use href="#MJMAIN-77" x="567" y="0"></use></g></g><g transform="translate(1936,0)"><rect stroke="none" width="620" height="60" x="0" y="220"></rect><use href="#MJMAIN-31" x="60" y="676"></use><use href="#MJMAIN-32" x="60" y="-686"></use></g><g transform="translate(2843,0)"><use href="#MJSZ2-2211"></use><g transform="translate(147,-1090)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-69"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-3D" x="345" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1124" y="0"></use></g><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E" x="721" y="1627"></use></g><use href="#MJMAIN-28" x="4288" y="0"></use><g transform="translate(4677,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-2212" x="6294" y="0"></use><g transform="translate(7295,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><g transform="translate(8751,0)"><use href="#MJMAIN-29"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="550" y="583"></use></g></g><g transform="translate(0,-1465)"><g transform="translate(120,0)"><rect stroke="none" width="620" height="60" x="0" y="220"></rect><use href="#MJMAIN-31" x="60" y="676"></use><use href="#MJMAIN-32" x="60" y="-686"></use></g><g transform="translate(1027,0)"><use href="#MJSZ2-2211"></use><g transform="translate(147,-1090)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-69"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-3D" x="345" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1124" y="0"></use></g><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E" x="721" y="1627"></use></g><g transform="translate(2758,0)"><rect stroke="none" width="1410" height="60" x="0" y="220"></rect><use href="#MJMAIN-2202" x="421" y="676"></use><g transform="translate(60,-687)"><use href="#MJMAIN-2202"></use><use href="#MJMAIN-77" x="567" y="0"></use></g></g><use href="#MJMAIN-28" x="4455" y="0"></use><g transform="translate(4844,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-2212" x="6461" y="0"></use><g transform="translate(7462,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><g transform="translate(8918,0)"><use href="#MJMAIN-29"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="550" y="583"></use></g></g></g></g><g transform="translate(41690,0)"><g transform="translate(0,1597)"><g id="mjx-eqn-12"><use href="#MJMAIN-28"></use><use href="#MJMAIN-31" x="389" y="0"></use><use href="#MJMAIN-32" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g><g transform="translate(0,-1465)"><g id="mjx-eqn-13"><use href="#MJMAIN-28"></use><use href="#MJMAIN-31" x="389" y="0"></use><use href="#MJMAIN-33" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-118">
\begin{align}
&\frac{\partial}{\partial\mathrm{w}}\frac{1}{2}\sum_{i=1}^{n}(y^{(i)}-\bar{y}^{(i)})^2\\
=&\frac{1}{2}\sum_{i=1}^{n}\frac{\partial}{\partial\mathrm{w}}(y^{(i)}-\bar{y}^{(i)})^2\\
\end{align}
</script><p></p><p data-anchor-id="af8s">现在我们可以不管高大上的<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-119-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 1056.5 1040.4001387359851" style="width: 2.419ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJSZ1-2211"></use></g></svg></span><script type="math/tex" id="MathJax-Element-119">\sum</script>了，先专心把里面的导数求出来。</p><div class="md-section-divider"></div><p data-anchor-id="4zul"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-120-Frame" style="font-size: 100%; display: inline-block;"><span style="display: inline-block; white-space: nowrap; padding: 1px 0px;"><span style="display: inline-block; position: relative; width: 102.823ex; height: 10.403ex; vertical-align: -4.597ex;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -2520.915932271218 44270.673387096766 4541.831864542436" style="width: 102.823ex; height: 10.524ex; position: absolute; bottom: 0ex; left: 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(15805,0)"><g transform="translate(-15,0)"><use href="#MJMAIN-3D" x="0" y="-1293"></use></g><g transform="translate(1042,0)"><g transform="translate(0,1109)"><g transform="translate(120,0)"><rect stroke="none" width="1410" height="60" x="0" y="220"></rect><use href="#MJMAIN-2202" x="421" y="676"></use><g transform="translate(60,-687)"><use href="#MJMAIN-2202"></use><use href="#MJMAIN-77" x="567" y="0"></use></g></g><use href="#MJMAIN-28" x="1816" y="0"></use><g transform="translate(2206,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-2212" x="3823" y="0"></use><g transform="translate(4823,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><g transform="translate(6279,0)"><use href="#MJMAIN-29"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="550" y="583"></use></g></g><g transform="translate(0,-1293)"><g transform="translate(120,0)"><rect stroke="none" width="1410" height="60" x="0" y="220"></rect><use href="#MJMAIN-2202" x="421" y="676"></use><g transform="translate(60,-687)"><use href="#MJMAIN-2202"></use><use href="#MJMAIN-77" x="567" y="0"></use></g></g><use href="#MJMAIN-28" x="1816" y="0"></use><g transform="translate(2206,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="1124" y="0"></use></g></g><use href="#MJMAIN-2212" x="4177" y="0"></use><use href="#MJMAIN-32" x="5177" y="0"></use><g transform="translate(5678,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><g transform="translate(7134,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-2B" x="8751" y="0"></use><g transform="translate(9751,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="1124" y="0"></use></g></g><use href="#MJMAIN-29" x="11561" y="0"></use></g></g></g><g transform="translate(41690,0)"><g transform="translate(0,1109)"><g id="mjx-eqn-14"><use href="#MJMAIN-28"></use><use href="#MJMAIN-31" x="389" y="0"></use><use href="#MJMAIN-34" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g><g transform="translate(0,-1293)"><g id="mjx-eqn-15"><use href="#MJMAIN-28"></use><use href="#MJMAIN-31" x="389" y="0"></use><use href="#MJMAIN-35" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g></g></g></svg></span></span></span></div><script type="math/tex; mode=display" id="MathJax-Element-120">
\begin{align}
&\frac{\partial}{\partial\mathrm{w}}(y^{(i)}-\bar{y}^{(i)})^2\\
=&\frac{\partial}{\partial\mathrm{w}}(y^{(i)2}-2\bar{y}^{(i)}y^{(i)}+\bar{y}^{(i)2})\\
\end{align}
</script><p></p><p data-anchor-id="nxcj">我们知道，<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-121-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-121">y</script>是与<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-122-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 722.5 482.40013873598514" style="width: 1.694ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-77"></use></g></svg></span><script type="math/tex" id="MathJax-Element-122">\mathrm{w}</script>无关的常数，而<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-123-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -861.5104670124718 3743.887282901478 1086.7105363804644" style="width: 8.71ex; height: 2.54ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><use href="#MJMAIN-3D" x="838" y="0"></use><g transform="translate(1894,0)"><use href="#MJMAIN-77"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-54" x="1021" y="513"></use></g><use href="#MJMAIN-78" x="3215" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-123">\bar{y}=\mathrm{w}^T\mathrm{x}</script>，下面我们根据链式求导法则来求导(上大学时好像叫复合函数求导法则)</p><div class="md-section-divider"></div><p data-anchor-id="1dho"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-124-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -1491.4079322712182 9375.897222222222 2402.8158645424364" style="width: 21.774ex; height: 5.565ex; vertical-align: -2.177ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(120,0)"><rect stroke="none" width="2953" height="60" x="0" y="220"></rect><g transform="translate(60,721)"><use href="#MJMAIN-2202"></use><g transform="translate(567,0)"><use href="#MJMATHI-45"></use><use href="#MJMAIN-28" x="764" y="0"></use><use href="#MJMAIN-77" x="1154" y="0"></use><use href="#MJMAIN-29" x="1876" y="0"></use></g></g><g transform="translate(831,-687)"><use href="#MJMAIN-2202"></use><use href="#MJMAIN-77" x="567" y="0"></use></g></g><use href="#MJMAIN-3D" x="3471" y="0"></use><g transform="translate(4647,0)"><rect stroke="none" width="2791" height="60" x="0" y="220"></rect><g transform="translate(60,721)"><use href="#MJMAIN-2202"></use><g transform="translate(567,0)"><use href="#MJMATHI-45"></use><use href="#MJMAIN-28" x="764" y="0"></use><g transform="translate(1154,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use></g><use href="#MJMAIN-29" x="1714" y="0"></use></g></g><g transform="translate(831,-687)"><use href="#MJMAIN-2202"></use><g transform="translate(567,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use></g></g></g><g transform="translate(7845,0)"><rect stroke="none" width="1410" height="60" x="0" y="220"></rect><g transform="translate(140,676)"><use href="#MJMAIN-2202"></use><g transform="translate(567,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use></g></g><g transform="translate(60,-687)"><use href="#MJMAIN-2202"></use><use href="#MJMAIN-77" x="567" y="0"></use></g></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-124">
\frac{\partial{E(\mathrm{w})}}{\partial\mathrm{w}}=\frac{\partial{E(\bar{y})}}{\partial\bar{y}}\frac{\partial{\bar{y}}}{\partial\mathrm{w}}
</script><p></p><p data-anchor-id="y4si">我们分别计算上式等号右边的两个偏导数</p><div class="md-section-divider"></div><p data-anchor-id="ezcl"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-125-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -4701.73046005838 44270.673387096766 8903.46092011676" style="width: 102.823ex; height: 20.685ex; vertical-align: -9.798ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(14151,0)"><g transform="translate(-15,0)"><g transform="translate(0,3210)"><g transform="translate(120,0)"><rect stroke="none" width="2953" height="60" x="0" y="220"></rect><g transform="translate(60,721)"><use href="#MJMAIN-2202"></use><g transform="translate(567,0)"><use href="#MJMATHI-45"></use><use href="#MJMAIN-28" x="764" y="0"></use><use href="#MJMAIN-77" x="1154" y="0"></use><use href="#MJMAIN-29" x="1876" y="0"></use></g></g><g transform="translate(912,-687)"><use href="#MJMAIN-2202"></use><g transform="translate(567,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use></g></g></g><use href="#MJMAIN-3D" x="3471" y="0"></use></g><use href="#MJMAIN-3D" x="3471" y="1074"></use><g transform="translate(1543,-2172)"><g transform="translate(120,0)"><rect stroke="none" width="1410" height="60" x="0" y="220"></rect><g transform="translate(140,676)"><use href="#MJMAIN-2202"></use><g transform="translate(567,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use></g></g><g transform="translate(60,-687)"><use href="#MJMAIN-2202"></use><use href="#MJMAIN-77" x="567" y="0"></use></g></g><use href="#MJMAIN-3D" x="1927" y="0"></use></g><use href="#MJMAIN-3D" x="3471" y="-3932"></use></g><g transform="translate(4513,0)"><g transform="translate(0,3210)"><g transform="translate(120,0)"><rect stroke="none" width="1248" height="60" x="0" y="220"></rect><use href="#MJMAIN-2202" x="340" y="676"></use><g transform="translate(60,-687)"><use href="#MJMAIN-2202"></use><g transform="translate(567,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use></g></g></g><use href="#MJMAIN-28" x="1654" y="0"></use><g transform="translate(2044,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="1124" y="0"></use></g></g><use href="#MJMAIN-2212" x="4015" y="0"></use><use href="#MJMAIN-32" x="5015" y="0"></use><g transform="translate(5516,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><g transform="translate(6972,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-2B" x="8589" y="0"></use><g transform="translate(9590,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="1124" y="0"></use></g></g><use href="#MJMAIN-29" x="11399" y="0"></use></g><g transform="translate(0,1074)"><use href="#MJMAIN-2212"></use><use href="#MJMAIN-32" x="778" y="0"></use><g transform="translate(1279,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-2B" x="2896" y="0"></use><use href="#MJMAIN-32" x="3896" y="0"></use><g transform="translate(4397,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g></g><g transform="translate(0,-2172)"><g transform="translate(120,0)"><rect stroke="none" width="1410" height="60" x="0" y="220"></rect><use href="#MJMAIN-2202" x="421" y="676"></use><g transform="translate(60,-687)"><use href="#MJMAIN-2202"></use><use href="#MJMAIN-77" x="567" y="0"></use></g></g><g transform="translate(1816,0)"><use href="#MJMAIN-77"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-54" x="1021" y="583"></use></g><use href="#MJMAIN-78" x="3137" y="0"></use></g><use href="#MJMAIN-78" x="0" y="-3932"></use></g></g><g transform="translate(41690,0)"><g transform="translate(0,3210)"><g id="mjx-eqn-16"><use href="#MJMAIN-28"></use><use href="#MJMAIN-31" x="389" y="0"></use><use href="#MJMAIN-36" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g><g transform="translate(0,1074)"><g id="mjx-eqn-17"><use href="#MJMAIN-28"></use><use href="#MJMAIN-31" x="389" y="0"></use><use href="#MJMAIN-37" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g><g transform="translate(0,-228)"><g id="mjx-eqn-18"><use href="#MJMAIN-28"></use><use href="#MJMAIN-31" x="389" y="0"></use><use href="#MJMAIN-38" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g><g transform="translate(0,-2172)"><g id="mjx-eqn-19"><use href="#MJMAIN-28"></use><use href="#MJMAIN-31" x="389" y="0"></use><use href="#MJMAIN-39" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g><g transform="translate(0,-3932)"><g id="mjx-eqn-20"><use href="#MJMAIN-28"></use><use href="#MJMAIN-32" x="389" y="0"></use><use href="#MJMAIN-30" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-125">
\begin{align}
\frac{\partial{E(\mathrm{w})}}{\partial\bar{y}}=
&\frac{\partial}{\partial\bar{y}}(y^{(i)2}-2\bar{y}^{(i)}y^{(i)}+\bar{y}^{(i)2})\\
=&-2y^{(i)}+2\bar{y}^{(i)}\\\\
\frac{\partial{\bar{y}}}{\partial\mathrm{w}}=
&\frac{\partial}{\partial\mathrm{w}}\mathrm{w}^T\mathrm{x}\\
=&\mathrm{x}
\end{align}
</script><p></p><p data-anchor-id="qb0j">代入，我们求得<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-126-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 1056.5 1040.4001387359851" style="width: 2.419ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJSZ1-2211"></use></g></svg></span><script type="math/tex" id="MathJax-Element-126">\sum</script>里面的偏导数是</p><div class="md-section-divider"></div><p data-anchor-id="rs1z"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-127-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -2067.522597155154 44270.673387096766 3635.045194310308" style="width: 102.823ex; height: 8.468ex; vertical-align: -3.75ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(18219,0)"><g transform="translate(-15,0)"><use href="#MJMAIN-3D" x="0" y="-1298"></use></g><g transform="translate(1042,0)"><g transform="translate(0,655)"><g transform="translate(120,0)"><rect stroke="none" width="1410" height="60" x="0" y="220"></rect><use href="#MJMAIN-2202" x="421" y="676"></use><g transform="translate(60,-687)"><use href="#MJMAIN-2202"></use><use href="#MJMAIN-77" x="567" y="0"></use></g></g><use href="#MJMAIN-28" x="1816" y="0"></use><g transform="translate(2206,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-2212" x="3823" y="0"></use><g transform="translate(4823,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><g transform="translate(6279,0)"><use href="#MJMAIN-29"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="550" y="583"></use></g></g><g transform="translate(0,-1298)"><use href="#MJMAIN-32"></use><use href="#MJMAIN-28" x="500" y="0"></use><use href="#MJMAIN-2212" x="890" y="0"></use><g transform="translate(1668,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-2B" x="3285" y="0"></use><g transform="translate(4286,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-29" x="5742" y="0"></use><use href="#MJMAIN-78" x="6131" y="0"></use></g></g></g><g transform="translate(41690,0)"><g transform="translate(0,655)"><g id="mjx-eqn-21"><use href="#MJMAIN-28"></use><use href="#MJMAIN-32" x="389" y="0"></use><use href="#MJMAIN-31" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g><g transform="translate(0,-1298)"><g id="mjx-eqn-22"><use href="#MJMAIN-28"></use><use href="#MJMAIN-32" x="389" y="0"></use><use href="#MJMAIN-32" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-127">
\begin{align}
&\frac{\partial}{\partial\mathrm{w}}(y^{(i)}-\bar{y}^{(i)})^2\\
=&2(-y^{(i)}+\bar{y}^{(i)})\mathrm{x}
\end{align}
</script><p></p><p data-anchor-id="0zxq">最后代入<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-128-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 3099.5 1040.4001387359851" style="width: 7.258ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-2207"></use><use href="#MJMATHI-45" x="833" y="0"></use><use href="#MJMAIN-28" x="1598" y="0"></use><use href="#MJMAIN-77" x="1987" y="0"></use><use href="#MJMAIN-29" x="2710" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-128">\nabla{E}(\mathrm{w})</script>，求得</p><div class="md-section-divider"></div><p data-anchor-id="fji1"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-129-Frame" style="font-size: 100%; display: inline-block;"><span style="display: inline-block; white-space: nowrap; padding: 1px 0px;"><span style="display: inline-block; position: relative; width: 102.823ex; height: 20.685ex; vertical-align: -9.798ex;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -4713.320442276732 44270.673387096766 8926.640884553464" style="width: 102.823ex; height: 20.685ex; position: absolute; bottom: 0ex; left: 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(15211,0)"><g transform="translate(-15,0)"><g transform="translate(0,3129)"><use href="#MJMAIN-2207"></use><g transform="translate(833,0)"><use href="#MJMATHI-45"></use><use href="#MJMAIN-28" x="764" y="0"></use><use href="#MJMAIN-77" x="1154" y="0"></use><use href="#MJMAIN-29" x="1876" y="0"></use></g></g></g><g transform="translate(3363,0)"><g transform="translate(0,3129)"><use href="#MJMAIN-3D"></use><g transform="translate(1176,0)"><rect stroke="none" width="620" height="60" x="0" y="220"></rect><use href="#MJMAIN-31" x="60" y="676"></use><use href="#MJMAIN-32" x="60" y="-686"></use></g><g transform="translate(2083,0)"><use href="#MJSZ2-2211"></use><g transform="translate(147,-1090)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-69"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-3D" x="345" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1124" y="0"></use></g><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E" x="721" y="1627"></use></g><g transform="translate(3814,0)"><rect stroke="none" width="1410" height="60" x="0" y="220"></rect><use href="#MJMAIN-2202" x="421" y="676"></use><g transform="translate(60,-687)"><use href="#MJMAIN-2202"></use><use href="#MJMAIN-77" x="567" y="0"></use></g></g><use href="#MJMAIN-28" x="5511" y="0"></use><g transform="translate(5900,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-2212" x="7517" y="0"></use><g transform="translate(8518,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><g transform="translate(9974,0)"><use href="#MJMAIN-29"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="550" y="583"></use></g></g><g transform="translate(0,66)"><use href="#MJMAIN-3D"></use><g transform="translate(1176,0)"><rect stroke="none" width="620" height="60" x="0" y="220"></rect><use href="#MJMAIN-31" x="60" y="676"></use><use href="#MJMAIN-32" x="60" y="-686"></use></g><g transform="translate(2083,0)"><use href="#MJSZ2-2211"></use><g transform="translate(147,-1090)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-69"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-3D" x="345" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1124" y="0"></use></g><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E" x="721" y="1627"></use></g><use href="#MJMAIN-32" x="3694" y="0"></use><use href="#MJMAIN-28" x="4195" y="0"></use><use href="#MJMAIN-2212" x="4584" y="0"></use><g transform="translate(5363,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-2B" x="6980" y="0"></use><g transform="translate(7980,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-29" x="9436" y="0"></use><use href="#MJMAIN-78" x="9826" y="0"></use></g><g transform="translate(0,-2997)"><use href="#MJMAIN-3D"></use><use href="#MJMAIN-2212" x="1056" y="0"></use><g transform="translate(2001,0)"><use href="#MJSZ2-2211"></use><g transform="translate(147,-1090)"><use transform="scale(0.7071067811865476)" href="#MJMATHI-69"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-3D" x="345" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1124" y="0"></use></g><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E" x="721" y="1627"></use></g><use href="#MJMAIN-28" x="3445" y="0"></use><g transform="translate(3835,0)"><use href="#MJMATHI-79"></use><g transform="translate(499,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-2212" x="5452" y="0"></use><g transform="translate(6453,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use><g transform="translate(560,412)"><use transform="scale(0.7071067811865476)" href="#MJMAIN-28"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="389" y="0"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-29" x="734" y="0"></use></g></g><use href="#MJMAIN-29" x="7908" y="0"></use><use href="#MJMAIN-78" x="8298" y="0"></use></g></g></g><g transform="translate(41690,0)"><g transform="translate(0,3129)"><g id="mjx-eqn-23"><use href="#MJMAIN-28"></use><use href="#MJMAIN-32" x="389" y="0"></use><use href="#MJMAIN-33" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g><g transform="translate(0,66)"><g id="mjx-eqn-24"><use href="#MJMAIN-28"></use><use href="#MJMAIN-32" x="389" y="0"></use><use href="#MJMAIN-34" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g><g transform="translate(0,-2997)"><g id="mjx-eqn-25"><use href="#MJMAIN-28"></use><use href="#MJMAIN-32" x="389" y="0"></use><use href="#MJMAIN-35" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g></g></g></svg></span></span></span></div><script type="math/tex; mode=display" id="MathJax-Element-129">
\begin{align}
\nabla{E(\mathrm{w})}&=\frac{1}{2}\sum_{i=1}^{n}\frac{\partial}{\partial\mathrm{w}}(y^{(i)}-\bar{y}^{(i)})^2\\
&=\frac{1}{2}\sum_{i=1}^{n}2(-y^{(i)}+\bar{y}^{(i)})\mathrm{x}\\
&=-\sum_{i=1}^{n}(y^{(i)}-\bar{y}^{(i)})\mathrm{x}
\end{align}
</script><p></p><p data-anchor-id="we6f">至此，大功告成。</p><div class="md-section-divider"></div><h3 data-anchor-id="xwdp" id="随机梯度下降算法stochastic-gradient-descent-sgd">随机梯度下降算法(Stochastic Gradient Descent, SGD)</h3><p data-anchor-id="pflh">如果我们根据(式3)来训练模型，那么我们每次更新<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-130-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 722.5 482.40013873598514" style="width: 1.694ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-77"></use></g></svg></span><script type="math/tex" id="MathJax-Element-130">\mathrm{w}</script>的迭代，要遍历训练数据中所有的样本进行计算，我们称这种算法叫做<strong>批梯度下降(Batch Gradient Descent)</strong>。如果我们的样本非常大，比如数百万到数亿，那么计算量异常巨大。因此，实用的算法是SGD算法。在SGD算法中，每次更新<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-131-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 722.5 482.40013873598514" style="width: 1.694ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-77"></use></g></svg></span><script type="math/tex" id="MathJax-Element-131">\mathrm{w}</script>的迭代，只计算一个样本。这样对于一个具有数百万样本的训练数据，完成一次遍历就会对<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-132-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 722.5 482.40013873598514" style="width: 1.694ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-77"></use></g></svg></span><script type="math/tex" id="MathJax-Element-132">\mathrm{w}</script>更新数百万次，效率大大提升。由于样本的噪音和随机性，每次更新<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-133-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 722.5 482.40013873598514" style="width: 1.694ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-77"></use></g></svg></span><script type="math/tex" id="MathJax-Element-133">\mathrm{w}</script>并不一定按照减少<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-134-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -700.2000693679926 764.5 720.4001387359851" style="width: 1.815ex; height: 1.694ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-45"></use></g></svg></span><script type="math/tex" id="MathJax-Element-134">E</script>的方向。然而，虽然存在一定随机性，大量的更新总体上沿着减少<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-135-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -700.2000693679926 764.5 720.4001387359851" style="width: 1.815ex; height: 1.694ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-45"></use></g></svg></span><script type="math/tex" id="MathJax-Element-135">E</script>的方向前进的，因此最后也能收敛到最小值附近。下图展示了SGD和BGD的区别</p><p data-anchor-id="rp4w"><img src="./零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器_files/2256672-3152002d503d768e.png" alt="" title=""></p><p data-anchor-id="e39x">如上图，椭圆表示的是函数值的等高线，椭圆中心是函数的最小值点。红色是BGD的逼近曲线，而紫色是SGD的逼近曲线。我们可以看到BGD是一直向着最低点前进的，而SGD明显躁动了许多，但总体上仍然是向最低点逼近的。</p><p data-anchor-id="wnhm">最后需要说明的是，SGD不仅仅效率高，而且随机性有时候反而是好事。今天的目标函数是一个『凸函数』，沿着梯度反方向就能找到全局唯一的最小值。然而对于非凸函数来说，存在许多局部最小值。随机性有助于我们逃离某些很糟糕的局部最小值，从而获得一个更好的模型。</p><div class="md-section-divider"></div><h2 data-anchor-id="3j9k" id="实现线性单元">实现线性单元</h2><blockquote data-anchor-id="xfdk" class="white-blockquote">
  <p>完整代码请参考GitHub: <a href="https://github.com/hanbt/learn_dl/blob/master/linear_unit.py" target="_blank">https://github.com/hanbt/learn_dl/blob/master/linear_unit.py</a> (python2.7)</p>
</blockquote><p data-anchor-id="upml">接下来，让我们撸一把代码。</p><p data-anchor-id="j1cz">因为我们已经写了感知器的代码，因此我们先比较一下感知器模型和线性单元模型，看看哪些代码能够复用。</p><table data-anchor-id="pry9" class="table table-striped-white table-bordered">
<thead>
<tr>
 <th>算法</th>
 <th>感知器</th>
 <th>线性单元</th>
</tr>
</thead>
<tbody><tr>
 <td>模型<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-136-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 1928 1040.4001387359851" style="width: 4.476ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-68"></use><use href="#MJMAIN-28" x="576" y="0"></use><use href="#MJMATHI-78" x="966" y="0"></use><use href="#MJMAIN-29" x="1538" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-136">h(x)</script></td>
 <td><span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-137-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -861.5104670124718 11770.79080645161 3963.264536380464" style="width: 27.339ex; height: 9.194ex; vertical-align: -7.258ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use><use href="#MJMAIN-3D" x="775" y="0"></use><use href="#MJMATHI-66" x="1831" y="0"></use><use href="#MJMAIN-28" x="2382" y="0"></use><g transform="translate(2771,0)"><use href="#MJMAIN-77"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-54" x="1021" y="513"></use></g><use href="#MJMAIN-78" x="4092" y="0"></use><use href="#MJMAIN-29" x="4620" y="0"></use><g transform="translate(0,-2133)"><use href="#MJMATHI-66"></use><use href="#MJMAIN-28" x="550" y="0"></use><use href="#MJMATHI-7A" x="940" y="0"></use><use href="#MJMAIN-29" x="1408" y="0"></use><use href="#MJMAIN-3D" x="2075" y="0"></use><g transform="translate(2854,0)"><use href="#MJSZ3-7B"></use><g transform="translate(917,0)"><g transform="translate(-15,0)"><g transform="translate(0,550)"><use href="#MJMAIN-31"></use><use href="#MJMATHI-7A" x="2500" y="0"></use><use href="#MJMAIN-3E" x="3246" y="0"></use><use href="#MJMAIN-30" x="4303" y="0"></use></g><g transform="translate(0,-650)"><use href="#MJMAIN-30"></use><use href="#MJMATHI-6F" x="2500" y="0"></use><use href="#MJMATHI-74" x="2986" y="0"></use><use href="#MJMATHI-68" x="3347" y="0"></use><use href="#MJMATHI-65" x="3924" y="0"></use><use href="#MJMATHI-72" x="4390" y="0"></use><use href="#MJMATHI-77" x="4842" y="0"></use><use href="#MJMATHI-69" x="5558" y="0"></use><use href="#MJMATHI-73" x="5904" y="0"></use><use href="#MJMATHI-65" x="6373" y="0"></use></g></g></g></g></g></g></svg></span><script type="math/tex" id="MathJax-Element-137">y=f(\mathrm{w}^T\mathrm{x})\\f(z)=\begin{equation}\begin{cases}1\qquad z>0\\0\qquad otherwise\end{cases}\end{equation}</script></td>
 <td><span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-138-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -861.5104670124718 14947.86266129032 2564.264536380464" style="width: 34.718ex; height: 5.927ex; vertical-align: -3.992ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use><use href="#MJMAIN-3D" x="775" y="0"></use><use href="#MJMATHI-66" x="1831" y="0"></use><use href="#MJMAIN-28" x="2382" y="0"></use><g transform="translate(2771,0)"><use href="#MJMAIN-77"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-54" x="1021" y="513"></use></g><use href="#MJMAIN-78" x="4092" y="0"></use><use href="#MJMAIN-29" x="4620" y="0"></use><g transform="translate(0,-1433)"><use href="#MJMATHI-66"></use><use href="#MJMAIN-28" x="550" y="0"></use><use href="#MJMATHI-7A" x="940" y="0"></use><use href="#MJMAIN-29" x="1408" y="0"></use><use href="#MJMAIN-3D" x="2075" y="0"></use><use href="#MJMATHI-7A" x="2854" y="0"></use></g></g></svg></span><script type="math/tex" id="MathJax-Element-138">y=f(\mathrm{w}^T\mathrm{x})\\f(z)=z</script></td>
</tr>
<tr>
 <td>训练规则</td>
 <td><span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-139-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 8316.119444444445 1040.4001387359851" style="width: 19.355ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-77"></use><use href="#MJMAIN-2190" x="1000" y="0"></use><use href="#MJMAIN-77" x="2278" y="0"></use><use href="#MJMAIN-2B" x="3223" y="0"></use><use href="#MJMATHI-3B7" x="4224" y="0"></use><use href="#MJMAIN-28" x="4727" y="0"></use><use href="#MJMATHI-79" x="5117" y="0"></use><use href="#MJMAIN-2212" x="5836" y="0"></use><g transform="translate(6837,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use></g><use href="#MJMAIN-29" x="7398" y="0"></use><use href="#MJMAIN-78" x="7787" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-139">\mathrm{w}\gets\mathrm{w}+\eta(y-\bar{y})\mathrm{x}</script></td>
 <td><span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-140-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 8316.119444444445 1040.4001387359851" style="width: 19.355ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-77"></use><use href="#MJMAIN-2190" x="1000" y="0"></use><use href="#MJMAIN-77" x="2278" y="0"></use><use href="#MJMAIN-2B" x="3223" y="0"></use><use href="#MJMATHI-3B7" x="4224" y="0"></use><use href="#MJMAIN-28" x="4727" y="0"></use><use href="#MJMATHI-79" x="5117" y="0"></use><use href="#MJMAIN-2212" x="5836" y="0"></use><g transform="translate(6837,0)"><use href="#MJMATHI-79" x="1" y="0"></use><use href="#MJMAIN-AF" x="60" y="-21"></use></g><use href="#MJMAIN-29" x="7398" y="0"></use><use href="#MJMAIN-78" x="7787" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-140">\mathrm{w}\gets\mathrm{w}+\eta(y-\bar{y})\mathrm{x}</script></td>
</tr>
</tbody></table><p data-anchor-id="nchg">比较的结果令人震惊，原来除了激活函数<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-141-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -725.2000693679926 550.5 950.4001387359851" style="width: 1.331ex; height: 2.177ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-66"></use></g></svg></span><script type="math/tex" id="MathJax-Element-141">f</script>不同之外，两者的模型和训练规则是一样的(在上表中，线性单元的优化算法是SGD算法)。那么，我们只需要把感知器的激活函数进行替换即可。感知器的代码请参考上一篇文章<a href="https://www.zybuluo.com/hanbingtao/note/433855" target="_blank">零基础入门深度学习(1) - 感知器</a>，这里就不再重复了。对于一个养成良好习惯的程序员来说，重复代码是不可忍受的。大家应该把代码保存在一个代码库中(比如git)。</p><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="zw2m" style=""><ol class="linenums"><li class="L0"><code class="language-python"><span class="kwd">from</span><span class="pln"> perceptron </span><span class="kwd">import</span><span class="pln"> </span><span class="typ">Perceptron</span></code></li><li class="L1"><code class="language-python"></code></li><li class="L2"><code class="language-python"><span class="com">#定义激活函数f</span></code></li><li class="L3"><code class="language-python"><span class="pln">f </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">lambda</span><span class="pln"> x</span><span class="pun">:</span><span class="pln"> x</span></code></li><li class="L4"><code class="language-python"></code></li><li class="L5"><code class="language-python"><span class="kwd">class</span><span class="pln"> </span><span class="typ">LinearUnit</span><span class="pun">(</span><span class="typ">Perceptron</span><span class="pun">):</span></code></li><li class="L6"><code class="language-python"><span class="pln">    </span><span class="kwd">def</span><span class="pln"> __init__</span><span class="pun">(</span><span class="pln">self</span><span class="pun">,</span><span class="pln"> input_num</span><span class="pun">):</span></code></li><li class="L7"><code class="language-python"><span class="pln">        </span><span class="str">'''初始化线性单元，设置输入参数的个数'''</span></code></li><li class="L8"><code class="language-python"><span class="pln">        </span><span class="typ">Perceptron</span><span class="pun">.</span><span class="pln">__init__</span><span class="pun">(</span><span class="pln">self</span><span class="pun">,</span><span class="pln"> input_num</span><span class="pun">,</span><span class="pln"> f</span><span class="pun">)</span></code></li></ol></pre><p data-anchor-id="uck4">通过继承Perceptron，我们仅用几行代码就实现了线性单元。这再次证明了面向对象编程范式的强大。</p><p data-anchor-id="uceo">接下来，我们用简单的数据进行一下测试。</p><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="me1w" style=""><ol class="linenums"><li class="L0"><code class="language-python"><span class="kwd">def</span><span class="pln"> get_training_dataset</span><span class="pun">():</span></code></li><li class="L1"><code class="language-python"><span class="pln">    </span><span class="str">'''</span></code></li><li class="L2"><code class="language-python"><span class="str">    捏造5个人的收入数据</span></code></li><li class="L3"><code class="language-python"><span class="str">    '''</span></code></li><li class="L4"><code class="language-python"><span class="pln">    </span><span class="com"># 构建训练数据</span></code></li><li class="L5"><code class="language-python"><span class="pln">    </span><span class="com"># 输入向量列表，每一项是工作年限</span></code></li><li class="L6"><code class="language-python"><span class="pln">    input_vecs </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[[</span><span class="lit">5</span><span class="pun">],</span><span class="pln"> </span><span class="pun">[</span><span class="lit">3</span><span class="pun">],</span><span class="pln"> </span><span class="pun">[</span><span class="lit">8</span><span class="pun">],</span><span class="pln"> </span><span class="pun">[</span><span class="lit">1.4</span><span class="pun">],</span><span class="pln"> </span><span class="pun">[</span><span class="lit">10.1</span><span class="pun">]]</span></code></li><li class="L7"><code class="language-python"><span class="pln">    </span><span class="com"># 期望的输出列表，月薪，注意要与输入一一对应</span></code></li><li class="L8"><code class="language-python"><span class="pln">    labels </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">5500</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2300</span><span class="pun">,</span><span class="pln"> </span><span class="lit">7600</span><span class="pun">,</span><span class="pln"> </span><span class="lit">1800</span><span class="pun">,</span><span class="pln"> </span><span class="lit">11400</span><span class="pun">]</span></code></li><li class="L9"><code class="language-python"><span class="pln">    </span><span class="kwd">return</span><span class="pln"> input_vecs</span><span class="pun">,</span><span class="pln"> labels    </span></code></li><li class="L0"><code class="language-python"></code></li><li class="L1"><code class="language-python"></code></li><li class="L2"><code class="language-python"><span class="kwd">def</span><span class="pln"> train_linear_unit</span><span class="pun">():</span></code></li><li class="L3"><code class="language-python"><span class="pln">    </span><span class="str">'''</span></code></li><li class="L4"><code class="language-python"><span class="str">    使用数据训练线性单元</span></code></li><li class="L5"><code class="language-python"><span class="str">    '''</span></code></li><li class="L6"><code class="language-python"><span class="pln">    </span><span class="com"># 创建感知器，输入参数的特征数为1（工作年限）</span></code></li><li class="L7"><code class="language-python"><span class="pln">    lu </span><span class="pun">=</span><span class="pln"> </span><span class="typ">LinearUnit</span><span class="pun">(</span><span class="lit">1</span><span class="pun">)</span></code></li><li class="L8"><code class="language-python"><span class="pln">    </span><span class="com"># 训练，迭代10轮, 学习速率为0.01</span></code></li><li class="L9"><code class="language-python"><span class="pln">    input_vecs</span><span class="pun">,</span><span class="pln"> labels </span><span class="pun">=</span><span class="pln"> get_training_dataset</span><span class="pun">()</span></code></li><li class="L0"><code class="language-python"><span class="pln">    lu</span><span class="pun">.</span><span class="pln">train</span><span class="pun">(</span><span class="pln">input_vecs</span><span class="pun">,</span><span class="pln"> labels</span><span class="pun">,</span><span class="pln"> </span><span class="lit">10</span><span class="pun">,</span><span class="pln"> </span><span class="lit">0.01</span><span class="pun">)</span></code></li><li class="L1"><code class="language-python"><span class="pln">    </span><span class="com">#返回训练好的线性单元</span></code></li><li class="L2"><code class="language-python"><span class="pln">    </span><span class="kwd">return</span><span class="pln"> lu</span></code></li><li class="L3"><code class="language-python"></code></li><li class="L4"><code class="language-python"></code></li><li class="L5"><code class="language-python"><span class="kwd">if</span><span class="pln"> __name__ </span><span class="pun">==</span><span class="pln"> </span><span class="str">'__main__'</span><span class="pun">:</span><span class="pln"> </span></code></li><li class="L6"><code class="language-python"><span class="pln">    </span><span class="str">'''训练线性单元'''</span></code></li><li class="L7"><code class="language-python"><span class="pln">    linear_unit </span><span class="pun">=</span><span class="pln"> train_linear_unit</span><span class="pun">()</span></code></li><li class="L8"><code class="language-python"><span class="pln">    </span><span class="com"># 打印训练获得的权重</span></code></li><li class="L9"><code class="language-python"><span class="pln">    </span><span class="kwd">print</span><span class="pln"> linear_unit</span></code></li><li class="L0"><code class="language-python"><span class="pln">    </span><span class="com"># 测试</span></code></li><li class="L1"><code class="language-python"><span class="pln">    </span><span class="kwd">print</span><span class="pln"> </span><span class="str">'Work 3.4 years, monthly salary = %.2f'</span><span class="pln"> </span><span class="pun">%</span><span class="pln"> linear_unit</span><span class="pun">.</span><span class="pln">predict</span><span class="pun">([</span><span class="lit">3.4</span><span class="pun">])</span></code></li><li class="L2"><code class="language-python"><span class="pln">    </span><span class="kwd">print</span><span class="pln"> </span><span class="str">'Work 15 years, monthly salary = %.2f'</span><span class="pln"> </span><span class="pun">%</span><span class="pln"> linear_unit</span><span class="pun">.</span><span class="pln">predict</span><span class="pun">([</span><span class="lit">15</span><span class="pun">])</span></code></li><li class="L3"><code class="language-python"><span class="pln">    </span><span class="kwd">print</span><span class="pln"> </span><span class="str">'Work 1.5 years, monthly salary = %.2f'</span><span class="pln"> </span><span class="pun">%</span><span class="pln"> linear_unit</span><span class="pun">.</span><span class="pln">predict</span><span class="pun">([</span><span class="lit">1.5</span><span class="pun">])</span></code></li><li class="L4"><code class="language-python"><span class="pln">    </span><span class="kwd">print</span><span class="pln"> </span><span class="str">'Work 6.3 years, monthly salary = %.2f'</span><span class="pln"> </span><span class="pun">%</span><span class="pln"> linear_unit</span><span class="pun">.</span><span class="pln">predict</span><span class="pun">([</span><span class="lit">6.3</span><span class="pun">])</span></code></li></ol></pre><p data-anchor-id="q61y">程序运行结果如下图</p><p data-anchor-id="hnss"><img src="./零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器_files/2256672-92f00082e3db32d2.png" alt="" title=""></p><p data-anchor-id="dmlz">拟合的直线如下图</p><p data-anchor-id="lozr"><img src="./零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器_files/2256672-b2db886ef2f18771.png" alt="" title=""></p><div class="md-section-divider"></div><h2 data-anchor-id="h3gp" id="小结">小结</h2><p data-anchor-id="3wq2">事实上，一个机器学习算法其实只有两部分</p><ul data-anchor-id="qyi9">
<li><em>模型</em>  从输入特征<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-142-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 528.5 471.40013873598514" style="width: 1.21ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-78"></use></g></svg></span><script type="math/tex" id="MathJax-Element-142">\mathrm{x}</script>预测输入<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-143-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-143">y</script>的那个函数<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-144-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 1928 1040.4001387359851" style="width: 4.476ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-68"></use><use href="#MJMAIN-28" x="576" y="0"></use><use href="#MJMATHI-78" x="966" y="0"></use><use href="#MJMAIN-29" x="1538" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-144">h(x)</script></li>
<li><em>目标函数</em> 目标函数取最小(最大)值时所对应的参数值，就是模型的参数的<strong>最优值</strong>。很多时候我们只能获得目标函数的<strong>局部最小(最大)值</strong>，因此也只能得到模型参数的<strong>局部最优值</strong>。</li>
</ul><p data-anchor-id="dnc4">因此，如果你想最简洁的介绍一个算法，列出这两个函数就行了。</p><p data-anchor-id="d9eo">接下来，你会用<strong>优化算法</strong>去求取目标函数的最小(最大)值。<strong>[随机]梯度{下降|上升}</strong>算法就是一个<strong>优化算法</strong>。针对同一个<strong>目标函数</strong>，不同的<strong>优化算法</strong>会推导出不同的<strong>训练规则</strong>。我们后面还会讲其它的优化算法。</p><p data-anchor-id="gu0n">其实在机器学习中，算法往往并不是关键，真正的关键之处在于选取特征。选取特征需要我们人类对问题的深刻理解，经验、以及思考。而<strong>神经网络</strong>算法的一个优势，就在于它能够自动学习到应该提取什么特征，从而使算法不再那么依赖人类，而这也是神经网络之所以吸引人的一个方面。</p><p data-anchor-id="ad7n">现在，经过漫长的烧脑，你已经具备了学习<strong>神经网络</strong>的必备知识。下一篇文章，我们将介绍本系列文章的主角：<strong>神经网络</strong>，以及用来训练神经网络的大名鼎鼎的算法：<strong>反向传播</strong>算法。至于现在，我们应该暂时忘记一切，尽情奖励自己一下吧。</p><p data-anchor-id="ycsh"><img src="http://news.nem365.com/UploadFiles/2011-08-25/news365/2011082517452068896.jpg" alt="" title=""></p><p data-anchor-id="79qs">本想放个日料的，怕被说成<strong>不爱国</strong>，换成毛爷爷家的红烧肉吧:P</p><div class="md-section-divider"></div><h2 data-anchor-id="3y4z" id="参考资料">参考资料</h2><ol data-anchor-id="brjl">
<li>Tom M. Mitchell, "机器学习", 曾华军等译, 机械工业出版社</li>
</ol></div>
    <div class="remark-icons"><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="0s4w">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="0jag">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="top: 255px; left: 1350px; display: none;" data-anchor-id="hyta">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count">+</span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="mweo">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="odhz">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="qtus">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="wvb4">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="oftw">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="xmsb">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="oks1">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="aicn">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="raas">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="qs9m">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="is43">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="872p">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="pqy7">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="xglz">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="wn30">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="1cd0">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="ziuq">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="wqf4">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="e3ap">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="8mmg">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="rdsk">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="fmrf">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="vuc0">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="ji69">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="6fwl">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="y0wr">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="cppd">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="ft42">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="wa02">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="d02m">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="pm94">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="ayjr">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="sire">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="cv41">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="e68r">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="4d8e">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="hjsi">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="bsh7">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="52yu">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="yde6">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="2zyw">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="ub0y">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="vudw">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="usyo">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="2fpi">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="chn1">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="9mhc">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="r0e7">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="g1g8">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="1rfq">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="28u8">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="zc2p">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="htcu">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="d23c">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="q6ke">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="zmg2">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="aiyd">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="haeg">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="eiz8">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="4tvz">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="umxg">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="jkf7">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="5ozh">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="p6vv">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="cj9h">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="ntxr">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="eglt">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="gsyf">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="yrzt">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="8dcf">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="j0tz">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="ll1q">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="8f5s">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="04h2">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="ueud">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="znr7">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="admf">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="2olm">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="5k4c">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="ds6s">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="rpyy">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="sbmh">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="vkow">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="ilgc">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="ra7a">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="af8s">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="4zul">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="nxcj">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="1dho">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="y4si">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="ezcl">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="qb0j">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="rs1z">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="0zxq">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="fji1">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="we6f">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="xwdp">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="pflh">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="rp4w">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="e39x">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="wnhm">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="3j9k">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="xfdk">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="upml">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="j1cz">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="pry9">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="nchg">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="zw2m">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="uck4">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="uceo">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="me1w">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="q61y">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="hnss">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="dmlz">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="lozr">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="h3gp">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="3wq2">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="qyi9">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="dnc4">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="d9eo">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="gu0n">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="ad7n">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="ycsh">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="79qs">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="3y4z">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="brjl">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div></div>
</div>

<!--in page preview buttons. -->
<div class="in-page-preview-buttons in-page-preview-buttons-full-reader">
    <ul>
        <li class="in-page-button dropdown" id="preview-toc-button" title="内容目录 Ctrl+Alt+O">
            <span class="dropdown-toggle icon-list" data-toggle="dropdown" style="color: rgba(102, 128, 153, 0.45);"></span>
            <div id="toc-list" class="dropdown-menu theme pull-right theme-white"> <!-- Add theme means this element will be changed when apply theme color. -->
                <h3>内容目录</h3>
                <hr>
                <div class="table-of-contents"><div class="toc">
<ul>
<li><a href="https://www.zybuluo.com/hanbingtao/note/448086#%E9%9B%B6%E5%9F%BA%E7%A1%80%E5%85%A5%E9%97%A8%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A02-%E7%BA%BF%E6%80%A7%E5%8D%95%E5%85%83%E5%92%8C%E6%A2%AF%E5%BA%A6%E4%B8%8B%E9%99%8D">零基础入门深度学习(2) - 线性单元和梯度下降</a><ul>
<li><a href="https://www.zybuluo.com/hanbingtao/note/448086#%E6%96%87%E7%AB%A0%E5%88%97%E8%A1%A8">文章列表</a></li>
<li><a href="https://www.zybuluo.com/hanbingtao/note/448086#%E5%BE%80%E6%9C%9F%E5%9B%9E%E9%A1%BE">往期回顾</a></li>
<li><a href="https://www.zybuluo.com/hanbingtao/note/448086#%E7%BA%BF%E6%80%A7%E5%8D%95%E5%85%83%E6%98%AF%E5%95%A5">线性单元是啥</a><ul>
<li><a href="https://www.zybuluo.com/hanbingtao/note/448086#%E7%BA%BF%E6%80%A7%E5%8D%95%E5%85%83%E7%9A%84%E6%A8%A1%E5%9E%8B">线性单元的模型</a></li>
<li><a href="https://www.zybuluo.com/hanbingtao/note/448086#%E7%9B%91%E7%9D%A3%E5%AD%A6%E4%B9%A0%E5%92%8C%E6%97%A0%E7%9B%91%E7%9D%A3%E5%AD%A6%E4%B9%A0">监督学习和无监督学习</a></li>
<li><a href="https://www.zybuluo.com/hanbingtao/note/448086#%E7%BA%BF%E6%80%A7%E5%8D%95%E5%85%83%E7%9A%84%E7%9B%AE%E6%A0%87%E5%87%BD%E6%95%B0">线性单元的目标函数</a></li>
<li><a href="https://www.zybuluo.com/hanbingtao/note/448086#%E6%A2%AF%E5%BA%A6%E4%B8%8B%E9%99%8D%E4%BC%98%E5%8C%96%E7%AE%97%E6%B3%95">梯度下降优化算法</a><ul>
<li><a href="https://www.zybuluo.com/hanbingtao/note/448086#nablaemathrmwnablaemathrmw%E7%9A%84%E6%8E%A8%E5%AF%BC">\nabla{E}(\mathrm{w})的推导</a></li>
</ul>
</li>
<li><a href="https://www.zybuluo.com/hanbingtao/note/448086#%E9%9A%8F%E6%9C%BA%E6%A2%AF%E5%BA%A6%E4%B8%8B%E9%99%8D%E7%AE%97%E6%B3%95stochastic-gradient-descent-sgd">随机梯度下降算法(Stochastic Gradient Descent, SGD)</a></li>
</ul>
</li>
<li><a href="https://www.zybuluo.com/hanbingtao/note/448086#%E5%AE%9E%E7%8E%B0%E7%BA%BF%E6%80%A7%E5%8D%95%E5%85%83">实现线性单元</a></li>
<li><a href="https://www.zybuluo.com/hanbingtao/note/448086#%E5%B0%8F%E7%BB%93">小结</a></li>
<li><a href="https://www.zybuluo.com/hanbingtao/note/448086#%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99">参考资料</a></li>
</ul>
</li>
</ul>
</div>
</div>
            </div>
        </li>
    </ul>
</div>

<div id="reader-full-toolbar" class="reader-full-toolbar-shown" style="padding-top: 0;">
    <ul id="reader-full-toolbar-home" class="preview-button-row">
        <li class="preview-button-full-reader" id="preview-editor-button" title="撰写文本 Ctrl+Alt+M">
            <span class="icon-pencil" style="color: rgb(187, 187, 187);"></span>
        </li>
    </ul>
    <ul id="preview-button-row" class="preview-button-row">
        <li class="preview-button-full-reader dropdown" id="preview-list-button" title="文本列表 Ctrl+Alt+F">
            <span class="dropdown-toggle icon-reorder" data-toggle="dropdown" style="color: rgb(187, 187, 187);"></span>
            <ul id="file-list" class="dropdown-menu theme-black pull-right" role="menu" style="max-height: 652px;">
                    <li>
                    <ul class="tag-list">
                        <li class="tag-item item" tag-name="机器学习">
                            <span class="pull-left"><i class="icon-tag"></i><span class="tag-name">机器学习</span></span>
                            <span class="tag-count pull-right">7</span>
                            <div class="clearfix"></div>
                        </li>
                            
    <li class="file-item item" file-created-date="2017-02-28 00:59:57">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/626300" title="【已发布】 2017-08-29 23:41">
        <i class="icon-share-sign"></i>
        <span id="626300">零基础入门深度学习(7) - 递归神经网络</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2017-01-08 23:28:36">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/581764" title="【已发布】 2017-08-28 19:55">
        <i class="icon-share-sign"></i>
        <span id="581764">零基础入门深度学习(6) - 长短时记忆网络(LSTM)</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2016-11-05 19:16:51">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/541458" title="【已发布】 2017-08-28 19:54">
        <i class="icon-share-sign"></i>
        <span id="541458">零基础入门深度学习(5) - 循环神经网络</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2016-10-09 20:30:46">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/485480" title="【已发布】 2017-08-28 19:53">
        <i class="icon-share-sign"></i>
        <span id="485480">零基础入门深度学习(4) - 卷积神经网络</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2016-08-24 21:39:25">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/476663" title="【已发布】 2017-10-17 22:25">
        <i class="icon-share-sign"></i>
        <span id="476663">零基础入门深度学习(3) - 神经网络和反向传播算法</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2016-07-26 01:44:30">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/448086" title="【已发布】 2017-08-28 19:40">
        <i class="icon-share-sign"></i>
        <span id="448086" class="whiter-on-black">零基础入门深度学习(2) - 线性单元和梯度下降</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2016-07-12 11:10:42">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/433855" title="【已发布】 2017-08-28 19:35">
        <i class="icon-share-sign"></i>
        <span id="433855">零基础入门深度学习(1) - 感知器</span>
        </a>
    </li>

                    </ul>
                    </li>
                    <li>
                    <ul class="tag-list">
                        <li class="tag-item item" tag-name="深度学习入门">
                            <span class="pull-left"><i class="icon-tag"></i><span class="tag-name">深度学习入门</span></span>
                            <span class="tag-count pull-right">7</span>
                            <div class="clearfix"></div>
                        </li>
                            
    <li class="file-item item" file-created-date="2017-02-28 00:59:57">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/626300" title="【已发布】 2017-08-29 23:41">
        <i class="icon-share-sign"></i>
        <span id="626300">零基础入门深度学习(7) - 递归神经网络</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2017-01-08 23:28:36">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/581764" title="【已发布】 2017-08-28 19:55">
        <i class="icon-share-sign"></i>
        <span id="581764">零基础入门深度学习(6) - 长短时记忆网络(LSTM)</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2016-11-05 19:16:51">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/541458" title="【已发布】 2017-08-28 19:54">
        <i class="icon-share-sign"></i>
        <span id="541458">零基础入门深度学习(5) - 循环神经网络</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2016-10-09 20:30:46">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/485480" title="【已发布】 2017-08-28 19:53">
        <i class="icon-share-sign"></i>
        <span id="485480">零基础入门深度学习(4) - 卷积神经网络</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2016-08-24 21:39:25">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/476663" title="【已发布】 2017-10-17 22:25">
        <i class="icon-share-sign"></i>
        <span id="476663">零基础入门深度学习(3) - 神经网络和反向传播算法</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2016-07-26 01:44:30">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/448086" title="【已发布】 2017-08-28 19:40">
        <i class="icon-share-sign"></i>
        <span id="448086" class="whiter-on-black">零基础入门深度学习(2) - 线性单元和梯度下降</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2016-07-12 11:10:42">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/433855" title="【已发布】 2017-08-28 19:35">
        <i class="icon-share-sign"></i>
        <span id="433855">零基础入门深度学习(1) - 感知器</span>
        </a>
    </li>

                    </ul>
                    </li>
            </ul>
            <ul id="file-list-topbar" class="dropdown-menu theme-black pull-right" role="menu">
                <li id="search-file-bar">
                    <i class="icon-search icon-large"></i>
                    <input type="text" id="search-file-textbox" placeholder="搜索 hanbingtao 的文稿标题， * 显示全部">
                    <i class="icon-level-down icon-rotate-90 icon-large"></i>
                </li>
                <li id="tag-file-bar">
                    以下【标签】将用于标记这篇文稿：
                </li>
            </ul>
        </li>
        <li class="preview-button-full-reader" id="preview-theme-button" title="主题切换 Ctrl+Alt+Y">
            <span class="icon-adjust" style="color: rgb(187, 187, 187);"></span>
        </li>
        <li class="preview-button-full-reader" id="preview-fullscreen-button" title="全屏模式 F11">
            <span class="icon-fullscreen" style="color: rgb(187, 187, 187);"></span>
        </li>
        <li class="preview-button-full-reader wmd-spacer"></li>
        <li class="preview-button-full-reader dropdown" id="preview-about-button" title="关于本站">
            <span class="dropdown-toggle icon-info-sign" data-toggle="dropdown" data-hover="dropdown" data-delay="100" data-close-others="true" style="color: rgb(187, 187, 187);"></span>
            <ul id="about-menu" class="dropdown-menu theme-black pull-right" role="menu">
                <li title="下载全平台客户端"><a tabindex="-1" href="https://www.zybuluo.com/cmd" target="_blank"><i class="icon-laptop"></i>下载客户端</a></li>
                <li title="@ghosert"><a tabindex="-1" href="http://www.weibo.com/ghosert" target="_blank"><i class="icon-weibo"></i>关注开发者</a></li>
                <li title=""><a tabindex="-1" href="https://github.com/ghosert/cmd-editor/issues" target="_blank"><i class="icon-github-alt"></i>报告问题，建议</a></li>
                <li title="support@zybuluo.com"><a tabindex="-1" href="mailto:support@zybuluo.com" target="_blank"><i class="icon-envelope"></i>联系我们</a></li>
            </ul>
        </li>
    </ul>
</div>
<ul id="reader-full-toolbar-tail" class="reader-full-toolbar-tail-shown">
    <li class="preview-button-full-reader" id="preview-hidden-button" title="隐藏工具栏 Ctrl+Alt+I">
        <span class="icon-chevron-sign-right" style="color: rgb(187, 187, 187);"></span>
    </li>
</ul>






<!-- side remark, hidden when loading. -->
<div class="remark-list side-remark-hidden">
    <div class="remark-items"></div>
    <div class="leave-remark unselectable"><span class="icon-plus-sign-alt"></span><span>添加新批注</span></div>
    <div class="new-remark">
    <div class="remark-head"><a><img src="./零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器_files/default-head.jpg" style="width: 32px; height: 32px;"></a></div>
    <div class="remark-author unselectable"><strong>markliu2019</strong></div>
    <div class="remark-editor" contenteditable="true" spellcheck="false"></div>
    <!-- this will be filled up by js.
    <div class="inline-error">402/400</div> for new remark
    <div class="inline-error">202/200</div> for new reply
    -->
    <div class="remark-footer unselectable">
        <button class="remark-save btn-link">保存</button>
        <button class="remark-cancel btn-link">取消</button>
    </div>

        <!-- clone the template $('.new-remark-reply').html() to here.-->
        <div class="remark-notice">在作者公开此批注前，只有你和作者可见。</div>
    </div>
</div>

<!-- template for new remark/reply -->
<div class="new-remark-reply side-remark-hidden">
    <div class="remark-head"><a><img src="./零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器_files/default-head.jpg"></a></div>
    <div class="remark-author unselectable"></div>
    <div class="remark-editor" contenteditable="true" spellcheck="false"></div>
    <!-- this will be filled up by js.
    <div class="inline-error">402/400</div> for new remark
    <div class="inline-error">202/200</div> for new reply
    -->
    <div class="remark-footer unselectable">
        <button class="remark-save btn-link">保存</button>
        <button class="remark-cancel btn-link">取消</button>
    </div>
</div>

<!-- template for .remark-item/.remark-reply -->
<div class="remark-item-reply side-remark-hidden">
    <div class="remark-head"><a><img src="./零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器_files/default-head.jpg"></a></div>
    <div class="remark-author unselectable"></div>
    <div class="remark-delete-link unselectable"><span class="icon-remove"></span></div> <!--This is mainly for deleting remark-reply, shown when author/remark hovering on remark-reply.-->
    <div class="remark-editor" contenteditable="true" spellcheck="false"></div>
    <!-- this will be filled up by js.
    <div class="inline-error">402/400</div> for new remark
    <div class="inline-error">202/200</div> for new reply
    -->
    <div class="remark-footer unselectable">
        <button class="remark-edit btn-link">修改</button>
        <button class="remark-save btn-link">保存</button>
        <button class="remark-cancel btn-link">取消</button>
        <button class="remark-delete btn-link">删除</button>
    </div>
</div>

<!-- template for remark-item-->
<div class="remark-item side-remark-hidden" data-rand-id="" data-version-id="">
    <div class="remark-published-link unselectable"><span class="icon-link icon-rotate-90"></span></div>
    <ul class="remark-options theme unselectable theme-white">
        <li class="remark-private"><span class="icon-eye-close"></span><span>私有</span></li>
        <li class="remark-public"><span class="icon-group"></span><span>公开</span></li>
        <li class="remark-delete"><span class="icon-remove"></span><span>删除</span></li>
    </ul>

    <!-- clone the template $('.remark-item-reply').html() to here.-->

    <button class="remark-reply-view-more btn-link">查看更早的 5 条回复</button>
    <div class="remark-replies">
        <!--
        <div class="remark-reply">
            clone the template $('.remark-item-reply').html() to here.
        </div>
        -->
    </div>

    <div class="leave-reply unselectable"><span>回复批注</span></div>
    <div class="new-reply">
        <!-- clone the template $('.new-remark-reply').html() to here.-->
    </div>
</div>

<!-- jiawzhang NOTICE: .remark-icons will be put to mdeditor.mako and user_note.mako, where next to .wmd-preview -->
<!-- <div class="remark-icons"></div> -->

<!-- template for remark-icon -->
<div class="remark-icon unselectable side-remark-hidden remark-icon-empty" style="display: none;">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div>


<!-- canvas, hidden always, this is used to convert svg to canvas and then convert canvas to png. -->
<canvas id="svg-canvas-image" class="editor-reader-hidden-always"></canvas>

<!-- This is the image panel to hold enlarged image/svg. -->
<div id="large-image-panel">
    <img id="large-image">
</div>


    


    <!-- Hidden Popup Modal -->
    <div id="notification-popup-window" class="modal hide fade theme theme-white" tabindex="-1" role="dialog" aria-labelledby="notification-title" aria-hidden="true">
        <div class="modal-header theme theme-white">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3 id="notification-title">通知</h3>
        </div>
        <div class="modal-body theme theme-white">
            <p></p>
        </div>
        <div class="modal-footer theme theme-white">
            <button id="notification-cancel" class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
            <button id="notification-confirm" class="btn btn-primary">确认</button>
        </div>
    </div>

    <!-- zybuluo's foot -->

    <script src="./零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器_files/288313bb.base.lib.min.js"></script>

    <script>
        Namespace('com.zybuluo.base');
        com.zybuluo.base.initData = {
            globalPromptUrl: "https://www.zybuluo.com/global/prompt",
        };
    </script>

    
    <!--mathjax-->
    <!--blacker: 1 below means font weight.-->
    <script type="text/x-mathjax-config;executed=true">
        MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ["\\(","\\)"]], processEscapes: true }, TeX: { equationNumbers: { autoNumber: "AMS" } }, messageStyle: "none", SVG: { blacker: 1 }});
    </script>
    <script src="./零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器_files/mathJax.js"></script>
    <!--mathjax source code is here: https://github.com/mathjax/MathJax.-->
    <script src="./零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器_files/mathJax(1).js"></script>

    <script>
        Namespace('com.zybuluo.mdeditor.layout');
        com.zybuluo.mdeditor.layout.initData = {
            // '' means not logged in, otherwise the logged in username, for mdeditor.mako, this value will be reset in render.js otherwise, for user_note.mako, it's rendered by server side.
            loggedInUsername: 'markliu2019',
            isPageOwner: 'False' === 'True' ? true : false,
            loginComeFromUrl: 'https://www.zybuluo.com/login?return_to=https%3A%2F%2Fwww.zybuluo.com%2Fhanbingtao%2Fnote%2F448086',
            noteRemarksUrl: "https://www.zybuluo.com/note/448086/remarks", 
            newNoteRemarkUrl: "https://www.zybuluo.com/note/448086/remark/new", 
            updateNoteRemarkUrl: "https://www.zybuluo.com/note/448086/remark/update", 
            deleteNoteRemarkUrl: "https://www.zybuluo.com/note/448086/remark/delete", 
            publishNoteRemarkUrl: "https://www.zybuluo.com/note/448086/remark/publish", 
            newNoteRemarkReplyUrl: "https://www.zybuluo.com/note/448086/remark_reply/new", 
            updateNoteRemarkReplyUrl: "https://www.zybuluo.com/note/448086/remark_reply/update", 
            deleteNoteRemarkReplyUrl: "https://www.zybuluo.com/note/448086/remark_reply/delete", 
        };

        // BEGIN: pace.js configuration
        window.paceOptions = {
            // disable others, enable for ajax call only,
            ajax: true,
            document: false,
            elements: false,
            eventLag: false,
        };
        // jiawzhang NOTICE: to make sure pace.js is working for any ajax call especially the jquery ajax, add 'Pace.restart()' into jquery ajax call like '$.post'
        // Originally, pace 0.5.6 doesn't support jquery ajax, see details in: https://github.com/HubSpot/pace/issues/29
        // END: pace.js configuration

    </script>

    <script src="./零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器_files/7a70106e.layout.lib.min.js"></script>

    <script src="./零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器_files/dc648f35.layout.min.js"></script><div id="medium-editor-toolbar-1" class="medium-editor-toolbar"><ul id="medium-editor-toolbar-actions" class="medium-editor-toolbar-actions clearfix"><li><button data-action="remark" class=" medium-editor-button-first"><i class="icon-comment"></i></button></li><li><button data-action="highlight" class=" medium-editor-button-last"><i class="icon-pencil"></i></button></li></ul></div>



    

    <!-- https://www.zybuluo.com/static/assets/mdeditor/user_note.lib.min.js -->
    <!-- -->

    <script>
        Namespace('com.zybuluo.mdeditor.user_note');
        com.zybuluo.mdeditor.user_note.initData = {
            isLoggedIn: 'True',
            mdeditorUrl: "https://www.zybuluo.com/mdeditor",
            passwordPassed: 'True' === 'True' ? true : false,
        };
    </script>

    <script src="./零基础入门深度学习(2) - 线性单元和梯度下降 - 作业部落 Cmd Markdown 编辑阅读器_files/6cd3112e.user_note.min.js"></script>





    
</body></html>